home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr18 / mrun210.zip / MRUN210.H < prev    next >
Text File  |  1993-04-28  |  95KB  |  4,068 lines

  1. ;MailRun v2.10:  Header File
  2. ;1992-1993 Gerald P. Sully, all rights reserved.
  3.  
  4. #comment
  5. **************************************************************************
  6. **************************************************************************
  7. * This header file contains routines that are used in various
  8. * places throughout the MailRun source files.  It also contains
  9. * global variable definitions and macros.
  10. * #ifdef commands have been used to exclude procedures and global
  11. * variables from being compiled in any script module where they
  12. * are not needed.  In theory, it should not be necessary to do
  13. * this:  Datastorm's documentation says that any procedure or
  14. * variable that isn't used is ignored.  In practice, however, the
  15. * compiler will use up its limited memory resources allocating
  16. * space to variables and procedures that never make their way into
  17. * the compiled script.
  18. * The following procedures/functions are found in this file
  19. * (roughly in order of appearance):
  20. * makefullname(), makemrn(), makebbslist(), maketasklist(), 
  21. * makemailrunlist(), makedesc(), gettaskstring(), loadsettings(), 
  22. * loadbbsinfo(), loadprompts(), loadmaildoor(), writesettings(), 
  23. * writebbsinfo(), writeprompts(), writemaildoor(), openfile(), 
  24. * readbbs(), readitem(), writebbs(), writeitem(), getbbscoord(), 
  25. * getitemcoord(), getbbsi(), getitemi(), getfirstitem(), copymrn(), 
  26. * fverify(), cleardir(), clearfiledesc(), insertitem(), insertbbs(), 
  27. * changemailrun(), checkpending(), checkperm(), checkchild(), 
  28. * checkrunning(), checkchanged(), checkfile(), checktask(), checknew(), 
  29. * menudim(), sortidx(), fieldcompare(), findstring(), interfaceon(), 
  30. * interfaceoff(), parsedialog(), swapbbs(), swapitem(), changestatus(),
  31. * taskfilefwd(), taskfileend(), parsemenu(), parseobject(), 
  32. * filenewmrun(), filesave(), filesaveas(), filereset(), filedelmrun(), 
  33. * fileautorun(), fileexit(), editcut(), editcopy(), editpaste(), 
  34. * editdelete(), cfgmrun(), cfgbbs(), cfgprompts(), cfgmaildoor(), 
  35. * configbbs(), configmrun(), configprompts(), configmaildoor(), 
  36. * defaultsmailrun(), defaultsbbs(), defaultsprompts(), defaultsdoor(), 
  37. * addnewbbs(), addgetsend(), addupload(), adddownload(), addsendcmd(), 
  38. * addscript(), executemailrun(), executeqwkreader(), executearchiver(),
  39. * executelogviewer(), helpcontents(), helpcontext(), helpabout(),
  40. * callscript()
  41. **************************************************************************
  42. **************************************************************************
  43. #endcomment
  44.  
  45. ;Open file indexes
  46.  
  47. #define IniFile 0
  48. #define MailRunFile 1
  49. #define BBSFile 0
  50. #define TaskFile 1
  51. #define OldTaskFile 2
  52. #define BBSidxFile 0
  53. #define BBSdbfFile 1
  54. #define NewFilesFile 2
  55. #define MRUnarcFile 3
  56. #define OldidxFile 4
  57. #define OlddbfFile 5
  58. #define ScriptFile 0
  59. #define QueueListFile 5
  60. #define OldUBFFile 0
  61. #define OldUDXFile 1
  62. #define MRunUBFFile 2
  63. #define MRunUDXFile 3
  64. #define FileDescFile 4
  65. #define SourceFile 5
  66.  
  67. ;Flags
  68.  
  69. #define ALLFLAGS 255                ; 2^8 - 1
  70. #define RUNNING 1                    ; 2^0
  71. #define CHANGED 2                    ; 2^1
  72. #define NEW 4                        ; 2^2
  73. #define AGM 8                        ; 2^3
  74. #define CMD 16                        ; 2^4
  75. #define SCR 32                        ; 2^5
  76. #define ABT 64                        ; 2^6
  77. #define USR 8                        ; 2^3
  78. #define PRMPT 16                    ; 2^4
  79. #define QMD 32                        ; 2^5
  80. #define DEFAULTS 128                ; 2^7
  81. #define IDLE (ALLFLAGS - RUNNING)
  82. #define UNCHANGED (ALLFLAGS - CHANGED)
  83. #define OLD (ALLFLAGS - NEW)
  84. #define CLEARCMD (ALLFLAGS - AGM - CMD - SCR - ABT)
  85.  
  86. ;System global variables
  87.  
  88. #define FLAGS i9
  89. #define IdleTimeout i8
  90. #define LogRun i7
  91. #define AppendLog i6
  92. #define AnsiInLog i5
  93. #define NewfileFilter i4
  94. #define GraphicsOn i3
  95. #define HelpPage i2
  96. #define PostRun i1
  97. #define IdleTimer i0
  98.  
  99. #define TaskItem s9
  100. #define MailRun s8
  101. #define MailRunIni s7
  102. #define TempDir s6
  103. #define MailRunDir s5
  104. #define TaskList s4
  105. #define BBS s3
  106. #define Item s2
  107. #define Conf s1
  108. #define CurrentConf s0
  109.  
  110. ;Macros
  111.  
  112. #define EscapeFail 0
  113. #define ErrorFail 1
  114. #define ALPHA 0
  115. #define NUMERIC 1
  116. #define MMDDYY 2
  117. #define _READWRITE 0
  118. #define _CREATE 1
  119. #define _TEXT 0
  120. #define _NORMAL 1
  121.  
  122. ;Miscellaneous global variables
  123.  
  124. string     MailRunTrunc
  125.  
  126. #ifndef MRUN210G
  127. #ifndef MRUN210B
  128. string    BBSList
  129. #endif
  130. #ifndef MRUN210F
  131. string    BBSType
  132. #endif
  133. #ifndef MRUN210AB
  134. #ifndef MRUN210C
  135. integer PermRadio
  136. #endif
  137. #endif
  138. #endif
  139.  
  140. #ifdef MRUN210AB
  141. string MailRunList
  142. #endif
  143.  
  144. #ifdef MRUN210DE
  145. string     FileName,        FileDesc,        FileChoice
  146. #endif
  147.  
  148. ;Global variables containing values displayed in the main dialogbox
  149.  
  150. #ifdef MRUN210AG
  151. string     BBSTotal,         BBSComplete,     BBSRemaining,    AttemptNum
  152. string     ItemTotal,         ItemComplete,    ItemError,         ItemRemaining
  153. #endif
  154.  
  155.  
  156. ;Global variables containing values from [MailRun] section of *.MRN
  157.  
  158. #ifdef MRUN210AB
  159. string     MailDir,            ReplyDir,        DownloadDir,    UploadDir
  160. string    DialAttempts,    DialTimeout,    DialPause
  161. string    SavePackets,    IdleTime,        ExecTime
  162. string    Archiver,        QWKReader,        LogViewer
  163. integer  GoWait
  164. #endif
  165.  
  166.  
  167. #ifndef MRUN210DE
  168. #ifndef MRUN210F
  169. #ifndef MRUN210G
  170.  
  171. ;Global variables containing general BBS info from *.MRN
  172.  
  173. string    BBSName,            UserName,        PWord,        XferProt
  174. string    CallingFrom,    UserResp1,        UserResp2
  175. string     Number_1,        Number_2,        Number_3
  176. string    LangNumber,        MailDoorType
  177.  
  178. ;Global variables containing BBS prompts from MAILRUN.INI
  179.  
  180. string     LangPrompt,        GraphicsPrompt,    NamePrompt,            UserPrompt1
  181. string    PWordPrompt,    ViewPrompt,            FilePrompt,            UserPrompt2
  182. string    ScanPrompt,        MorePrompt,            ContinuePrompt,    CommandPrompt
  183. string    DLPrompt,        DLUnavPrompt,        ULPrompt,            ULDescPrompt
  184.  
  185. ;Global variables containing Mail Door prompts from MAILRUN.INI
  186.  
  187. string    MailPrompt,        ReceiveQWKPrompt,    MailDLPrompt,  MsgMenuPrompt
  188. string     MailXferProt,    MailULPrompt,         QWKArchiver,    MailDoor
  189.  
  190. #endif
  191. #endif
  192. #endif
  193.  
  194.  
  195. #comment
  196. *********************************************************************
  197. * MAKEFULLNAME()
  198. * Called by all modules, various procedures
  199. * Appends a filename to a directory name.
  200. *********************************************************************
  201. #endcomment
  202.  
  203. func makefullname : string
  204. strparm Directory, FileNamen
  205. string FullName
  206.     FullName = Directory
  207.     addfilename FullName FileNamen
  208.     return FullName
  209. endfunc
  210.  
  211.  
  212. #comment
  213. *********************************************************************
  214. * MAKEMRN()
  215. * Calls loadsettings(), loadbbsinfo(), loadprompts(), loadmaildoor(),
  216. * writesettings(), writebbsinfo(), writeprompts(), writemaildoor(),
  217. * makefullname(), filesave()
  218. * Called by:
  219. *     MRUN210A:  initialize()
  220. *     MRUN210B:  newmailrun()
  221. * Create the file MAILRUN.MRN and initialize it.
  222. *********************************************************************
  223. #endcomment
  224.  
  225. #ifdef MRUN210AB
  226. proc makemrn
  227. string DLPurgeLimit
  228. #ifndef MRUN210A
  229. string RingInterrupt
  230. #endif
  231.     ;load the defaults 
  232.     MailRun = MailRunIni
  233.     BBS = "DEFAULT"
  234.     loadsettings()
  235.     loadbbsinfo()
  236.     loadprompts()
  237.     loadmaildoor()
  238.     profilerd MailRun "MailRun" "DLPurgeLimit" DLPurgeLimit
  239.     profilerd MailRun "MailRun" "ExecTime" ExecTime
  240.     profilerd MailRun "MailRun" "GoWait" GoWait
  241.     profilerd MailRun "MailRun" "PostRun" PostRun
  242.     profilerd MailRun "MailRun" "RingInterrupt" RingInterrupt
  243.     ;write the defaults to the new mailrun
  244.     MailRun = makefullname(TempDir, MailRunTrunc)
  245.     writesettings()
  246.     writebbsinfo()
  247.     writeprompts()
  248.     writemaildoor()
  249.     profilewr MailRun "MailRun" "DLPurgeLimit" DLPurgeLimit
  250.     profilewr MailRun "MailRun" "ExecTime" ExecTime
  251.     profilewr MailRun "MailRun" "GoWait" GoWait
  252.     profilewr MailRun "MailRun" "PostRun" PostRun
  253.     profilewr MailRun "MailRun" "RingInterrupt" RingInterrupt
  254.     ;write the new mailrun to disk
  255.     filesave()
  256. endproc
  257. #endif
  258.  
  259.  
  260. #comment
  261. *********************************************************************
  262. * MAKEBBSLIST()
  263. * Calls readbbs()
  264. * Called by:
  265. *     MRUN210H:  editdelete(), editpaste(), callscript()
  266. *     MRUN210C:  changeuserinfo(), changeprompts(), changemaildoor()
  267. *     MRUN210D:  main()
  268. *     MRUN210E:  main()
  269. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  270. * Creates a list of BBSs for display the BBS combobox of
  271. * various dialog boxes.
  272. *********************************************************************
  273. #endcomment
  274.  
  275. #ifndef MRUN210G
  276. #ifndef MRUN210B
  277. proc makebbslist
  278. string BBSi
  279. integer i
  280.     BBSList = ""
  281.     i = 1
  282.     BBSi = readbbs(i)
  283.     while not NULLSTR BBSi
  284.         strlwr BBSi
  285.         strfmt BBSList "%s,%s" BBSList BBSi
  286.         i++
  287.         BBSi = readbbs(i)
  288.     endwhile
  289.     if i > 1
  290.         strdelete BBSList 0 1
  291.     endif
  292. endproc
  293. #endif
  294. #endif
  295.  
  296.  
  297. #comment
  298. *********************************************************************
  299. * MAKETASKLIST()
  300. * Calls openfile(), gettaskstring(), readbbs(), readitem(),
  301. * makefullname()
  302. * Called by:
  303. *     MRUN210H:  editdelete(), changestatus(), filereset(),
  304. *                   filedelmrun(), editpaste(), callscript()
  305. *     MRUN210A:  main(), parsedialog(), swapbbs(), executor()
  306. *     MRUN210G:  main(), dobbs()
  307. * Creates the Task List displayed in the main MailRun
  308. * dialog box.  Each item of each BBS is read from the *.MRN
  309. * file and a "TaskString" is produced to describe its contents.
  310. * The BBS and Item coordinates are appended to the TaskString
  311. * as an index back into the *.MRN file.  Tabstops are used to
  312. * push these indexes beyond the right edge of the Task List
  313. * flistbox so that they are not visible.  TaskStrings for BBS
  314. * names have an item coordinate of zero.
  315. * Also calculates the values of variables displayed in the
  316. * statistics section of the main dialog box.
  317. *********************************************************************
  318. #endcomment
  319.  
  320. #ifdef MRUN210AG
  321. proc maketasklist
  322. string TaskString, Tasks, Pending
  323. string LastBBS, LastItem, BBSNamen
  324. integer BBST, BBSC, BBSR, ItemT, ItemC, ItemE, ItemR
  325. integer i, j
  326.     ;set all values displayed in main dialog box to 0
  327.     BBST = 0
  328.     BBSC = 0
  329.     BBSR = 0
  330.     ItemT = 0
  331.     ItemC = 0
  332.     ItemE = 0
  333.     Tasks = makefullname(TempDir, "TASKLIST.TMP")
  334.     ;Save the values for the current BBS and Item
  335.     LastItem = Item
  336.     LastBBS = BBS
  337.     openfile(TaskFile, Tasks, _CREATE, _NORMAL)
  338.     i = 1
  339.     BBS = readbbs(i)
  340.     while not NULLSTR BBS
  341.         ;Loop through each BBS in the MailRun
  342.         ItemR = 0
  343.         j = 0
  344.         profilerd MailRun BBS "BBSName" BBSNamen
  345.         fstrfmt TaskFile "%s`t`t`t%d`t%d`r`n" BBSNamen i j
  346.         j++
  347.         Item = readitem(j)
  348.         while not NULLSTR Item
  349.             ;Loop through each Item
  350.             strextract Pending Item "," 0
  351.             if strcmpi Pending "0"
  352.                 ItemC++
  353.             elseif strcmpi Pending "1"
  354.                 ItemR++
  355.             else
  356.                 ItemE++
  357.             endif
  358.             TaskString = gettaskstring(i, j)
  359.             fstrfmt TaskFile "%s`r`n" TaskString
  360.             ItemT++
  361.             j++
  362.             Item = readitem(j)
  363.         endwhile
  364.         BBST++
  365.         if ItemR == 0
  366.             BBSC++
  367.         endif
  368.         i++
  369.         BBS = readbbs(i)
  370.     endwhile
  371.     fclose TaskFile
  372.     Item = LastItem
  373.     BBS = LastBBS
  374.     ;prepare statistics variables for display in the main box
  375.     BBSR = BBST - BBSC
  376.     ItemR = ItemT - ItemC - ItemE
  377.     itoa BBST BBSTotal
  378.     itoa BBSC BBSComplete
  379.     itoa BBSR BBSRemaining
  380.     itoa ItemT ItemTotal
  381.     itoa ItemC ItemComplete
  382.     itoa ItemE ItemError
  383.     itoa ItemR ItemRemaining
  384. endproc
  385. #endif
  386.  
  387.  
  388. #comment
  389. *********************************************************************
  390. * MAKEMAILRUNLIST()
  391. * Calls makefullname()
  392. * Called by:
  393. *     MRUN210H:  filesaveas(), filedelmrun(), callscript()
  394. *     MRUN210A:  main()
  395. *     MRUN210B:  main(), newmailrun()
  396. * Creates a list of MailRuns for display in the main
  397. * MailRun and MailRun Settings dialog boxes.
  398. *********************************************************************
  399. #endcomment
  400.  
  401. #ifdef MRUN210AB
  402. proc makemailrunlist
  403. string FileTrunc, MRNFile
  404.     MailRunList = ""
  405.     MRNFile = makefullname(MailRunDir, "*.MRN")
  406.     findfirst MRNFile
  407.     ;Loop through all files in the directory
  408.     while FOUND
  409.         FileTrunc = $FILENAME
  410.         strlwr FileTrunc
  411.         strfmt MailRunList "%s,%s" MailRunList FileTrunc
  412.         findnext
  413.     endwhile
  414.     if not NULLSTR MailRunList
  415.         strdelete MailRunList 0 1
  416.     endif
  417. endproc
  418. #endif
  419.  
  420.  
  421. #comment
  422. *********************************************************************
  423. * MAKEDESC()
  424. * Calls openfile()
  425. * Called by:
  426. *     MRUN210D:  main(), deldlfile()
  427. *     MRUN210E:  getnewdesc()
  428. * Creates the file description for display in the upload
  429. * and download dialog boxes.
  430. *********************************************************************
  431. #endcomment
  432.  
  433. #ifdef MRUN210DE
  434. proc makedesc
  435. strparm DescSource
  436. string DB, DL
  437. integer char
  438. long DescBegin, DescLength, counter
  439.     strextract DB FileChoice "`t" 4
  440.     atol DB DescBegin
  441.     strextract DL FileChoice "`t" 5
  442.     atol DL DescLength
  443.     if DescLength != 0
  444.         ;if there is a description in the database, retrieve it
  445.         openfile(FileDescFile, FileDesc, _CREATE, _NORMAL)
  446.         openfile(SourceFile, DescSource, _READWRITE, _NORMAL)
  447.         fseek SourceFile DescBegin 0
  448.         for counter = 1 upto DescLength
  449.             fgetc SourceFile char
  450.             fputc FileDescFile char
  451.         endfor
  452.         fclose FileDescFile
  453.         fclose SourceFile
  454.     else
  455.         ;otherwise, just delete the previous description
  456.         openfile(FileDescFile, FileDesc, _CREATE, _NORMAL)
  457.         fclose FileDescFile
  458.     endif
  459. endproc
  460. #endif
  461.  
  462.  
  463. #comment
  464. *********************************************************************
  465. * GETTASKSTRING()
  466. * Called by:
  467. *     MRUN210H:  maketasklist(), editdelete(), changestatus(),
  468. *                  editpaste()
  469. *     MRUN210A:  parsekeystate(), swapitem()
  470. *     MRUN210C:  changeuserinfo(), changeprompts(), changemaildoor()
  471. *     MRUN210D:  main()
  472. *     MRUN210E:  main()
  473. *     MRUN210F:  addgetmail(), addsendmail(), adddoscript()
  474. *     MRUN210G:  dobbs()
  475. * Produces a TaskString from the current *.MRN Item.
  476. * Items are strings with the format:
  477. *         "Pending,Perm,TaskType,FileName,Conf"
  478. * Pending = 0 if item is completed, 1 if pending, 2 if an
  479. *         error occurred in previous attempt to execute it.
  480. * Perm = 1 if the item is permanent; Perm = 2 if temporary.
  481. * TaskType may be SendMail, GetMail, SendFile, GetFile,
  482. *         SendCommand or SendScript.
  483. * FileName is the name of the file to be transferred, used
  484. *         by SendFile and GetFile items.
  485. * Conf is the number of the conference to be joined, used
  486. *         by SendFile and GetFile items.
  487. *********************************************************************
  488. #endcomment
  489.  
  490. func gettaskstring : string
  491. intparm i, j
  492. string Pending, Perm, TaskType, TaskString, KeyString, BBSNamen
  493. string char, BBS_X, Item_X, BBSi, Itemi
  494.     strfmt BBS_X "BBS_%d" i
  495.     profilerd MailRun "MailRun" BBS_X BBSi
  496.     if j == 0
  497.         ;if this is for a BBS name
  498.         profilerd MailRun BBSi "BBSName" BBSNamen
  499.         strfmt TaskString "%s`t`t`t%d`t%d" BBSNamen i j
  500.     else
  501.         ;if this is for an item
  502.         strfmt Item_X "Item_%d" j
  503.         profilerd MailRun BBSi Item_X Itemi
  504.         strextract Pending Itemi "," 0
  505.         strextract Perm Itemi "," 1
  506.         strextract TaskType Itemi "," 2
  507.         if strcmpi Pending "1"
  508.             If strcmpi Perm "1"
  509.                 char = "#"
  510.             else
  511.                 char = "ñ"
  512.             endif
  513.         elseif strcmpi Pending "0"
  514.             char = "@"
  515.         else
  516.             char = " !"
  517.         endif
  518.         switch TaskType
  519.             case "SendMail"
  520.                 TaskString = "Send REP Packet"
  521.             endcase
  522.             case "GetMail"
  523.                 TaskString = "Get QWK Packet"
  524.             endcase
  525.             case "SendFile"
  526.                 strextract KeyString Itemi "," 3
  527.                 strextract Conf Itemi "," 4
  528.                 strfmt TaskString "Upload %s to Conference %s" KeyString Conf
  529.             endcase
  530.             case "GetFile"
  531.                 strextract keystring Itemi "," 3
  532.                 strextract Conf Itemi "," 4
  533.                 strfmt TaskString "Download %s from Conference %s" KeyString Conf
  534.             endcase
  535.             case "SendCommand"
  536.                 strextract KeyString Itemi "," 3
  537.                 strfmt TaskString "Send Command:  %s" KeyString
  538.             endcase
  539.             case "SendScript"
  540.                 strextract KeyString Itemi "," 3
  541.                 strfmt TaskString "Execute Script:  %s" KeyString
  542.             endcase
  543.         endswitch
  544.         strfmt TaskString "`t%s`t%s`t%d`t%d" char TaskString i j
  545.     endif
  546.     return TaskString
  547. endfunc
  548.  
  549.  
  550. #comment
  551. *********************************************************************
  552. * LOADSETTINGS()
  553. * Called by:
  554. *     MRUN210H:  makemrn(), changemailrun()
  555. *     MRUN210B:  main()
  556. * Initializes MailRun settings.
  557. *********************************************************************
  558. #endcomment
  559.  
  560. #ifdef MRUN210AB
  561. proc loadsettings
  562. string _MailRun
  563.     if FLAGS & DEFAULTS
  564.         _MailRun = MailRunIni
  565.     else
  566.         _MailRun = MailRun
  567.     endif
  568.     profilerd _MailRun "MailRun" "MailDir" MailDir
  569.     profilerd _MailRun "MailRun" "ReplyDir" ReplyDir
  570.     profilerd _MailRun "MailRun" "DownloadDir" DownloadDir
  571.     profilerd _MailRun "MailRun" "UploadDir" UploadDir
  572.     profilerd _MailRun "MailRun" "SavePackets" SavePackets
  573.     profilerd _MailRun "MailRun" "DialAttempts" DialAttempts
  574.     profilerd _MailRun "MailRun" "DialTimeout" DialTimeout
  575.     profilerd _MailRun "MailRun" "DialPause" DialPause
  576.     profilerd _MailRun "MailRun" "IdleTimeout" IdleTimeout
  577.     profilerd _MailRun "MailRun" "LogRun" LogRun
  578.     profilerd _MailRun "MailRun" "AppendLog" AppendLog
  579.     profilerd _MailRun "MailRun" "AnsiInLog" AnsiInLog
  580.     profilerd _MailRun "MailRun" "NewfileFilter" NewfileFilter
  581.     profilerd _MailRun "MailRun" "Archiver" Archiver
  582.     profilerd _MailRun "MailRun" "QWKReader" QWKReader
  583.     profilerd _MailRun "MailRun" "LogViewer" LogViewer
  584.     itoa IdleTimeout IdleTime
  585. endproc
  586. #endif
  587.  
  588.  
  589. #comment
  590. *********************************************************************
  591. * WRITESETTINGS()
  592. * Called by:  
  593. *     MRUN210H:  makemrn()
  594. *     MRUN210B:  main()
  595. * Writes MailRun settings to the *.MRN file.
  596. *********************************************************************
  597. #endcomment
  598.  
  599. #ifdef MRUN210AB
  600. proc writesettings
  601. string _MailRun
  602.     if FLAGS & DEFAULTS
  603.         _MailRun = MailRunIni
  604.     else
  605.         _MailRun = MailRun
  606.     endif
  607.     atoi IdleTime IdleTimeout
  608.     profilewr _MailRun "MailRun" "MailDir" MailDir
  609.     profilewr _MailRun "MailRun" "ReplyDir" ReplyDir
  610.     profilewr _MailRun "MailRun" "DownloadDir" DownloadDir
  611.     profilewr _MailRun "MailRun" "UploadDir" UploadDir
  612.     profilewr _MailRun "MailRun" "DialAttempts" DialAttempts
  613.     profilewr _MailRun "MailRun" "DialTimeout" DialTimeout
  614.     profilewr _MailRun "MailRun" "DialPause" DialPause
  615.     profilewr _MailRun "MailRun" "IdleTimeout" IdleTimeout
  616.     profilewr _MailRun "MailRun" "SavePackets" SavePackets
  617.     profilewr _MailRun "MailRun" "LogRun" LogRun
  618.     profilewr _MailRun "MailRun" "AppendLog" AppendLog
  619.     profilewr _MailRun "MailRun" "AnsiInLog" AnsiInLog
  620.     profilewr _MailRun "MailRun" "NewfileFilter" NewfileFilter
  621.     profilewr _MailRun "MailRun" "Archiver" Archiver
  622.     profilewr _MailRun "MailRun" "QWKReader" QWKReader
  623.     profilewr _MailRun "MailRun" "LogViewer" LogViewer
  624. endproc
  625. #endif
  626.  
  627.  
  628. #comment
  629. *********************************************************************
  630. * LOADBBSINFO()
  631. * Called by:
  632. *     MRUN210H:  makemrn(), editcopy(), editpaste()
  633. *     MRUN210C:  changeuserinfo(), addbbs()
  634. * Initializes BBS information.
  635. *********************************************************************
  636. #endcomment
  637.  
  638. #ifndef MRUN210DE
  639. #ifndef MRUN210F
  640. #ifndef MRUN210G
  641. proc loadbbsinfo
  642. string _BBS
  643.     if FLAGS & DEFAULTS
  644.         _BBS = "DEFAULT"
  645.     else
  646.         _BBS = BBS
  647.     endif
  648.     profilerd MailRun _BBS "BBSName" BBSName
  649.     profilerd MailRun _BBS "UserName" UserName
  650.     profilerd MailRun _BBS "PWord" Pword
  651.     profilerd MailRun _BBS "XferProt" XferProt
  652.     profilerd MailRun _BBS "MailXferProt" MailXferProt
  653.     profilerd MailRun _BBS "QWKArchiver" QWKArchiver
  654.     profilerd MailRun _BBS "Number_1" Number_1
  655.     profilerd MailRun _BBS "Number_2" Number_2
  656.     profilerd MailRun _BBS "Number_3" Number_3
  657.     profilerd MailRun _BBS "BBSType" BBSType
  658.     profilerd MailRun _BBS "MailDoorType" MailDoorType
  659. endproc
  660. #endif
  661. #endif
  662. #endif
  663.  
  664.  
  665. #comment
  666. *********************************************************************
  667. * WRITEBBSINFO()
  668. * Called by:
  669. *     MRUN210H:  makemrn(), editcopy(), editpaste()
  670. *     MRUN210C:  changeuserinfo()
  671. * Writes information for current BBS to the *.MRN file.
  672. *********************************************************************
  673. #endcomment
  674.  
  675. #ifndef MRUN210DE
  676. #ifndef MRUN210F
  677. #ifndef MRUN210G
  678. proc writebbsinfo
  679. string _BBS
  680.     if FLAGS & DEFAULTS
  681.         _BBS = "DEFAULT"
  682.     else
  683.         _BBS = BBS
  684.     endif
  685.     profilewr MailRun _BBS "BBSName" BBSName
  686.     profilewr MailRun _BBS "UserName" UserName
  687.     profilewr MailRun _BBS "PWord" PWord
  688.     profilewr MailRun _BBS "XferProt" XferProt
  689.     profilewr MailRun _BBS "MailXferProt" MailXferProt
  690.     profilewr MailRun _BBS "QWKArchiver" QWKArchiver
  691.     profilewr MailRun _BBS "Number_1" Number_1
  692.     profilewr MailRun _BBS "Number_2" Number_2
  693.     profilewr MailRun _BBS "Number_3" Number_3
  694.     profilewr MailRun _BBS "BBSType" BBSType
  695.     profilewr MailRun _BBS "MailDoorType" MailDoorType
  696. endproc
  697. #endif
  698. #endif
  699. #endif
  700.  
  701.  
  702. #comment
  703. *********************************************************************
  704. * LOADPROMPTS()
  705. * Called by:
  706. *     MRUN210H:  makemrn(), editcopy(), editpaste()
  707. *     MRUN210C:  changeuserinfo(), changeprompts(), addbbs()
  708. * Initializes BBS prompts.
  709. *********************************************************************
  710. #endcomment
  711.  
  712. #ifndef MRUN210DE
  713. #ifndef MRUN210F
  714. #ifndef MRUN210G
  715. proc loadprompts
  716. string _MailRun, _BBS
  717.     if FLAGS & DEFAULTS
  718.         _MailRun = MailRunIni
  719.         _BBS = BBSType
  720.     else
  721.         _MailRun = MailRun
  722.         _BBS = BBS
  723.     endif
  724.     profilerd _MailRun _BBS "CallingFrom" CallingFrom
  725.     profilerd _MailRun _BBS "UserResp1" UserResp1
  726.     profilerd _MailRun _BBS "UserResp2" UserResp2
  727.     profilerd _MailRun _BBS "LangNumber" LangNumber
  728.     profilerd _MailRun _BBS "GraphicsOn" GraphicsOn
  729.     profilerd _MailRun _BBS "LangPrompt" LangPrompt
  730.     profilerd _MailRun _BBS "GraphicsPrompt" GraphicsPrompt
  731.     profilerd _MailRun _BBS "NamePrompt" NamePrompt
  732.     profilerd _MailRun _BBS "PWordPrompt" PWordPrompt
  733.     profilerd _MailRun _BBS "UserPrompt1" UserPrompt1
  734.     profilerd _MailRun _BBS "UserPrompt2" UserPrompt2
  735.     profilerd _MailRun _BBS "ViewPrompt" ViewPrompt
  736.     profilerd _MailRun _BBS "ScanPrompt" ScanPrompt
  737.     profilerd _MailRun _BBS "FilePrompt" FilePrompt
  738.     profilerd _MailRun _BBS "MorePrompt" MorePrompt
  739.     profilerd _MailRun _BBS "ContinuePrompt" ContinuePrompt
  740.     profilerd _MailRun _BBS "CommandPrompt" CommandPrompt
  741.     profilerd _MailRun _BBS "DLPrompt" DLPrompt
  742.     profilerd _MailRun _BBS "DLUnavPrompt" DLUnavPrompt
  743.     profilerd _MailRun _BBS "ULPrompt" ULPrompt
  744.     profilerd _MailRun _BBS "ULDescPrompt" ULDescPrompt
  745. endproc
  746. #endif
  747. #endif
  748. #endif
  749.  
  750.  
  751. #comment
  752. *********************************************************************
  753. * WRITEPROMPTS()
  754. * Called by:
  755. *     MRUN210H:  makemrn(), editcopy(), editpaste()
  756. *     MRUN210C:  changeuserinfo(), changeprompts(), exportprompts()
  757. * Writes prompts for current BBS to the *.MRN file.
  758. *********************************************************************
  759. #endcomment
  760.  
  761. #ifndef MRUN210DE
  762. #ifndef MRUN210F
  763. #ifndef MRUN210G
  764. proc writeprompts
  765. string _MailRun, _BBS
  766.     if FLAGS & DEFAULTS
  767.         _MailRun = MailRunIni
  768.         _BBS = BBSType
  769.     else
  770.         _MailRun = MailRun
  771.         _BBS = BBS
  772.     endif
  773.     profilewr _MailRun _BBS "CallingFrom" CallingFrom
  774.     profilewr _MailRun _BBS "UserResp1" UserResp1
  775.     profilewr _MailRun _BBS "UserResp2" UserResp2
  776.     profilewr _MailRun _BBS "LangNumber" LangNumber
  777.     profilewr _MailRun _BBS "GraphicsOn" GraphicsOn
  778.     profilewr _MailRun _BBS "LangPrompt" LangPrompt
  779.     profilewr _MailRun _BBS "GraphicsPrompt" GraphicsPrompt
  780.     profilewr _MailRun _BBS "NamePrompt" NamePrompt
  781.     profilewr _MailRun _BBS "PWordPrompt" PWordPrompt
  782.     profilewr _MailRun _BBS "UserPrompt1" UserPrompt1
  783.     profilewr _MailRun _BBS "UserPrompt2" UserPrompt2
  784.     profilewr _MailRun _BBS "ViewPrompt" ViewPrompt
  785.     profilewr _MailRun _BBS "ScanPrompt" ScanPrompt
  786.     profilewr _MailRun _BBS "FilePrompt" FilePrompt
  787.     profilewr _MailRun _BBS "MorePrompt" MorePrompt
  788.     profilewr _MailRun _BBS "ContinuePrompt" ContinuePrompt
  789.     profilewr _MailRun _BBS "CommandPrompt" CommandPrompt
  790.     profilewr _MailRun _BBS "DLPrompt" DLPrompt
  791.     profilewr _MailRun _BBS "DLUnavPrompt" DLUnavPrompt
  792.     profilewr _MailRun _BBS "ULPrompt" ULPrompt
  793.     profilewr _MailRun _BBS "ULDescPrompt" ULDescPrompt
  794. endproc
  795. #endif
  796. #endif
  797. #endif
  798.  
  799.  
  800. #comment
  801. *********************************************************************
  802. * LOADMAILDOOR()
  803. * Called by:
  804. *     MRUN210H:  makemrn(), editcopy(), editpaste()
  805. *     MRUN210C:  changeuserinfo(), changemaildoor(), addbbs()
  806. * Initializes mail door prompts.
  807. *********************************************************************
  808. #endcomment
  809.  
  810. #ifndef MRUN210DE
  811. #ifndef MRUN210F
  812. #ifndef MRUN210G
  813. proc loadmaildoor
  814. string _MailRun, _BBS
  815.     if FLAGS & DEFAULTS
  816.         _MailRun = MailRunIni
  817.         _BBS = MailDoorType
  818.     else
  819.         _MailRun = MailRun
  820.         _BBS = BBS
  821.     endif
  822.     profilerd _MailRun _BBS "MailDoor" MailDoor
  823.     profilerd _MailRun _BBS "MailPrompt" MailPrompt
  824.     profilerd _MailRun _BBS "ReceiveQWKPrompt" ReceiveQWKPrompt
  825.     profilerd _MailRun _BBS "MailDLPrompt" MailDLPrompt
  826.     profilerd _MailRun _BBS "MailULPrompt" MailULPrompt
  827.     profilerd _MailRun _BBS "MsgMenuPrompt" MsgMenuPrompt
  828. endproc
  829. #endif
  830. #endif
  831. #endif
  832.  
  833.  
  834. #comment
  835. *********************************************************************
  836. * WRITEMAILDOOR()
  837. * Called by:
  838. *     MRUN210H:  makemrn(), editcopy(), editpaste()
  839. *     MRUN210C:  changeuserinfo(), changemaildoor(), 
  840. *                   exportmaildoor()
  841. * Writes mail door prompts for the current BBS to the .MRN
  842. * file.
  843. *********************************************************************
  844. #endcomment
  845.  
  846. #ifndef MRUN210DE
  847. #ifndef MRUN210F
  848. #ifndef MRUN210G
  849. proc writemaildoor
  850. string _MailRun, _BBS
  851.     if FLAGS & DEFAULTS
  852.         _MailRun = MailRunIni
  853.         _BBS = MailDoorType
  854.     else
  855.         _MailRun = MailRun
  856.         _BBS = BBS
  857.     endif
  858.     profilewr _MailRun _BBS "MailDoor" MailDoor
  859.     profilewr _MailRun _BBS "MailPrompt" MailPrompt
  860.     profilewr _MailRun _BBS "ReceiveQWKPrompt" ReceiveQWKPrompt
  861.     profilewr _MailRun _BBS "MailDLPrompt" MailDLPrompt
  862.     profilewr _MailRun _BBS "MailULPrompt" MailULPrompt
  863.     profilewr _MailRun _BBS "MsgMenuPrompt" MsgMenuPrompt
  864. endproc
  865. #endif
  866. #endif
  867. #endif
  868.  
  869.  
  870. #comment
  871. *********************************************************************
  872. * OPENFILE()
  873. * Calls fileexit()
  874. * Called by:
  875. *     MRUN210H:  maketasklist(), makedesc(), clearfiledesc(),
  876. *                   sortidx(), taskfilefwd()
  877. *     MRUN210D:  main(), purgeoldfiles(), getnewfiles(),
  878. *                   import(), deldlfile()
  879. *     MRUN210E:  insertulfile(), killfile(), getulfiles(),
  880. *                   updateudx()
  881. *     MRUN210F:  makescriptlist()
  882. *     MRUN210G:  makequeue(), getdialstring(), senddesc(), putdesc()
  883. * Opens a file in the manner specified.  If the file could
  884. * not be opened successfully, displays an error message and
  885. * terminates the script.
  886. *********************************************************************
  887. #endcomment
  888.  
  889. proc openfile
  890. intparm FileIndex
  891. strparm FileNamen
  892. intparm OpenMethod, OpenType
  893.     switch OpenMethod
  894.         case _CREATE
  895.             switch OpenType
  896.                 case _TEXT
  897.                     fopen FileIndex FileNamen CREATE TEXT
  898.                 endcase
  899.                 case _NORMAL
  900.                     fopen FileIndex FileNamen CREATE
  901.                 endcase
  902.             endswitch
  903.         endcase
  904.         case _READWRITE
  905.             switch OpenType
  906.                 case _TEXT
  907.                     fopen FileIndex FileNamen READWRITE TEXT
  908.                 endcase
  909.                 case _NORMAL
  910.                     fopen FileIndex FileNamen READWRITE
  911.                 endcase
  912.             endswitch
  913.         endcase
  914.     endswitch
  915.     if FAILURE
  916.         errormsg "Unable to open file %s;`r`nscript aborted...." FileNamen
  917.         fileexit()
  918.     endif
  919. endproc
  920.  
  921.  
  922. #comment
  923. *********************************************************************
  924. * READBBS()
  925. * Called by:
  926. *     MRUN210H:  makebbslist(), maketasklist(), getbbscoord(),
  927. *                   getbbsi(), insertbbs(), editdelete(),
  928. *                   filereset()
  929. *     MRUN210A:  swapbbs()
  930. *     MRUN210G:  main(), makequeue()
  931. * Reads the BBS associated with a BBS coordinate in the
  932. * current mailrun.
  933. *********************************************************************
  934. #endcomment
  935.  
  936. func readbbs : string
  937. intparm i
  938. string BBS_X, BBSi
  939.     strfmt BBS_X "BBS_%d" i
  940.     profilerd MailRun "MailRun" BBS_X BBSi
  941.     return BBSi
  942. endfunc
  943.  
  944.  
  945. #comment
  946. *********************************************************************
  947. * READITEM()
  948. * Called by:
  949. *     MRUN210H:  maketasklist(), getitemcoord(), getitemi(),
  950. *                   insertitem(), editdelete(), filereset(),
  951. *                   changestatus(), checkpending(), editcopy()
  952. *     MRUN210A:  swapitem()
  953. *     MRUN210G:  dobbs()
  954. * Reads the Item associated with a BBS coordinate in the
  955. * current mailrun.
  956. *********************************************************************
  957. #endcomment
  958.  
  959. func readitem : string
  960. intparm i
  961. string Item_X, Itemi
  962.     strfmt Item_X "Item_%d" i
  963.     profilerd MailRun BBS Item_X Itemi
  964.     return Itemi
  965. endfunc
  966.  
  967.  
  968. #comment
  969. *********************************************************************
  970. * WRITEBBS()
  971. * Called by:
  972. *     MRUN210H:  insertbbs(), editdelete()
  973. *     MRUN210A:  swapbbs()
  974. *     MRUN210C:  writenewbbs()
  975. * Writes a BBS ID to the given coordinate in the current
  976. * mailrun.
  977. *********************************************************************
  978. #endcomment
  979.  
  980. proc writebbs
  981. intparm i
  982. strparm BBSi
  983. string BBS_X
  984.     strfmt BBS_X "BBS_%d" i
  985.     profilewr MailRun "MailRun" BBS_X BBSi
  986. endproc
  987.  
  988.  
  989. #comment
  990. *********************************************************************
  991. * WRITEITEM()
  992. * Called by:
  993. *     MRUN210H:  insertitem(), editdelete(), filereset(),
  994. *                   changestatus()
  995. *     MRUN210A:  swapitem()
  996. *     MRUN210G:  dobbs()
  997. * Writes an Item to the given Item coordinate for the
  998. * current BBS and MailRun.
  999. *********************************************************************
  1000. #endcomment
  1001.  
  1002. proc writeitem
  1003. intparm i
  1004. strparm Itemi
  1005. string Item_X
  1006.     strfmt Item_X "Item_%d" i
  1007.     profilewr MailRun BBS Item_X Itemi
  1008. endproc
  1009.  
  1010.  
  1011. #comment
  1012. *********************************************************************
  1013. * GETBBSCOORD()
  1014. * Calls readbbs()
  1015. * Called by:
  1016. *     MRUN210C:  changeuserinfo(), changeprompts(), changemaildoor()
  1017. *     MRUN210D:  main()
  1018. *     MRUN210E:  main()
  1019. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1020. * Gets the BBS coordinate for a given BBS ID.
  1021. *********************************************************************
  1022. #endcomment
  1023.  
  1024. func getbbscoord : integer
  1025. integer i
  1026. string BBSi
  1027.     i = 1
  1028.     BBSi = readbbs(i)
  1029.     while not strcmpi BBS BBSi
  1030.         i++
  1031.         BBSi = readbbs(i)
  1032.     endwhile
  1033.     return i
  1034. endfunc
  1035.  
  1036.  
  1037. #comment
  1038. *********************************************************************
  1039. * GETITEMCOORD()
  1040. * Calls readitem()
  1041. * Called by:
  1042. *     MRUN210D:  main()
  1043. *     MRUN210E:  main()
  1044. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1045. * Gets the Item coordinate for a given Item in the current
  1046. * BBS.
  1047. *********************************************************************
  1048. #endcomment
  1049.  
  1050. func getitemcoord : integer
  1051. integer i
  1052.     i = 1
  1053.     Item = readitem(i)
  1054.     while not NULLSTR Item
  1055.         i++
  1056.         Item = readitem(i)
  1057.     endwhile
  1058.     i--
  1059.     Item = readitem(i)
  1060.     return i
  1061. endfunc
  1062.  
  1063.  
  1064. #comment
  1065. *********************************************************************
  1066. * GETBBSI()
  1067. * Calls readbbs()
  1068. * Called by:
  1069. *     MRUN210H:  editdelete(), changestatus(), editcopy(),
  1070. *                   editpaste()
  1071. *     MRUN210A:  parsekeystate()
  1072. *     MRUN210C:  changeuserinfo(), changeprompts(), changemaildoor()
  1073. *     MRUN210D:  main()
  1074. *     MRUN210E:  main()
  1075. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1076. * Gets the BBS ID associated with the currently selected
  1077. * item in the task list.  Returns the integer value of the
  1078. * BBS coordinate.
  1079. *********************************************************************
  1080. #endcomment
  1081.  
  1082. func getbbsi : integer
  1083. string char
  1084. integer i
  1085.     strextract char TaskItem "`t" 3
  1086.     atoi char i
  1087.     BBS = readbbs(i)
  1088.     return i
  1089. endfunc
  1090.  
  1091.  
  1092. #comment
  1093. *********************************************************************
  1094. * GETITEMI()
  1095. * Calls readitem()
  1096. * Called by:
  1097. *     MRUN210H:  editdelete(), changestatus(), editcopy(),
  1098. *                   editpaste()
  1099. *     MRUN210A:  parsekeystate()
  1100. *     MRUN210D:  main()
  1101. *     MRUN210E:  main()
  1102. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1103. * Gets the Item associated with the currently selected item
  1104. * in the task list.  Returns the integer value of the Item
  1105. * coordinate.
  1106. *********************************************************************
  1107. #endcomment
  1108.  
  1109. func getitemi : integer
  1110. string char
  1111. integer i
  1112.     strextract char TaskItem "`t" 4
  1113.     atoi char i
  1114.     Item = readitem(i)
  1115.     return i
  1116. endfunc
  1117.  
  1118.  
  1119. #comment
  1120. *********************************************************************
  1121. * GETFIRSTITEM()
  1122. * Called by:
  1123. *     MRUN210H:  filereset(), filedelmrun(), callscript()
  1124. *     MRUN210A:  main(), parsedialog()
  1125. * Highlights the first item in the task list.
  1126. *********************************************************************
  1127. #endcomment
  1128.  
  1129. proc getfirstitem
  1130. string BBSNamen
  1131.     profilerd MailRun "MailRun" "BBS_1" BBS
  1132.     if not NULLSTR BBS
  1133.         profilerd MailRun BBS "BBSName" BBSNamen
  1134.         strfmt TaskItem "%s`t`t`t%d`t%d" BBSNamen 1 0
  1135.     else
  1136.         TaskItem = ""
  1137.     endif
  1138. endproc
  1139.  
  1140.  
  1141. #comment
  1142. *********************************************************************
  1143. * COPYMRN()
  1144. * Calls makefullname()
  1145. * Called by:
  1146. *     MRUN210H:  changemailrun(), filesaveas(), filedelmrun()
  1147. * Copies a mailrun from MailRunDir to TempDir.
  1148. *********************************************************************
  1149. #endcomment
  1150.  
  1151. #ifdef MRUN210AB
  1152. proc copymrn
  1153. string LastRun
  1154.     delfile MailRun
  1155.     LastRun = makefullname(MailRunDir, MailRunTrunc)
  1156.     MailRun = makefullname(TempDir, MailRunTrunc)
  1157.     copyfile LastRun MailRun
  1158. endproc
  1159. #endif
  1160.  
  1161.  
  1162. #comment
  1163. *********************************************************************
  1164. * FVERIFY()
  1165. * Called by:
  1166. *     MRUN210H:  filesaveas()
  1167. *     MRUN210B:  newmailrun()
  1168. *     MRUN210C:  addbbs()
  1169. * Checks for a valid DOS filename (sans extension).
  1170. * Returns 1 if valid, 0 if invalid.
  1171. *********************************************************************
  1172. #endcomment
  1173.  
  1174. #ifndef MRUN210DE
  1175. #ifndef MRUN210F
  1176. #ifndef MRUN210G
  1177. func fverify : integer
  1178. strparm LookString
  1179. string DOSChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&()-_{}"
  1180. string char
  1181. integer i, j
  1182.     strlen LookString i
  1183.     if (i > 8) || (i == 0)
  1184.         return 0
  1185.     else
  1186.         i = 0
  1187.         strpeek LookString i j
  1188.         while j != 0
  1189.             strfmt char "%c" j
  1190.             if not strfind DOSChars char
  1191.                 return 0
  1192.             endif
  1193.             i++
  1194.             strpeek LookString i j
  1195.         endwhile
  1196.         return 1
  1197.     endif
  1198. endfunc
  1199. #endif
  1200. #endif
  1201. #endif
  1202.  
  1203.  
  1204. #comment
  1205. *********************************************************************
  1206. * CLEARDIR()
  1207. * Calls makefullname()
  1208. * Called by:
  1209. *     MRUN210H:  fileexit()
  1210. *     MRUN210A:  initialize()
  1211. *     MRUN210G:  getmail()
  1212. * Deletes the contents of a directory.
  1213. *********************************************************************
  1214. #endcomment
  1215.  
  1216. proc cleardir
  1217. strparm DirName
  1218. string DeadFile, DirFiles
  1219.     DirFiles = makefullname(DirName, "*.*")
  1220.     findfirst DirFiles
  1221.     while FOUND
  1222.         DeadFile = makefullname(DirName, $FILENAME)
  1223.         delfile DeadFile
  1224.         findnext
  1225.     endwhile
  1226. endproc
  1227.  
  1228.  
  1229. #comment
  1230. *********************************************************************
  1231. * CLEARFILEDESC()
  1232. * Calls openfile()
  1233. * Called by:
  1234. *     MRUN210D:  main(), deldlfile()
  1235. *     MRUN210E:  main(), insertulfile(), killfile()
  1236. * Clears the current file description box by creating a
  1237. * new file.
  1238. *********************************************************************
  1239. #endcomment
  1240.  
  1241. #ifdef MRUN210DE
  1242. proc clearfiledesc
  1243.     openfile(FileDescFile, FileDesc, _CREATE, _NORMAL)
  1244.     fclose FileDescFile
  1245. endproc
  1246. #endif
  1247.  
  1248.  
  1249. #comment
  1250. *********************************************************************
  1251. * INSERTITEM()
  1252. * Calls readitem(), writeitem()
  1253. * Called by:
  1254. *     MRUN210H:  editpaste()
  1255. *     MRUN210D:  main()
  1256. *     MRUN210E:  insertulfile()
  1257. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1258. * Inserts a new item into the *.MRN file.
  1259. *********************************************************************
  1260. #endcomment
  1261.  
  1262. proc insertitem
  1263. intparm i
  1264. strparm NovumItem
  1265. integer j, k
  1266.     j = i - 1
  1267.     Item = readitem(i)
  1268.     while not NULLSTR Item
  1269.         i++
  1270.         Item = readitem(i)
  1271.     endwhile
  1272.     k = i - 1
  1273.     while k > j
  1274.         Item = readitem(k)
  1275.         writeitem(i, Item)
  1276.         i--
  1277.         k--
  1278.     endwhile
  1279.     writeitem(i, NovumItem)
  1280.     Item = NovumItem
  1281. endproc
  1282.  
  1283.  
  1284. #comment
  1285. *********************************************************************
  1286. * INSERTBBS()
  1287. * Calls readbbs(), writebbs()
  1288. * Called by:
  1289. *     MRUN210H:  editpaste()
  1290. *     MRUN210C:  writenewbbs()
  1291. * Inserts a new BBS into the *.MRN file.
  1292. *********************************************************************
  1293. #endcomment
  1294.  
  1295. #ifndef MRUN210B
  1296. #ifndef MRUN210DE
  1297. #ifndef MRUN210F
  1298. #ifndef MRUN210G
  1299. proc insertbbs
  1300. intparm i
  1301. strparm NewBBS
  1302. string BBSi
  1303. integer j, k
  1304.     j =  i + 1
  1305.     BBSi = readbbs(j)
  1306.     ;Go to the last BBS
  1307.     while not NULLSTR BBSi
  1308.         j++
  1309.         BBSi = readbbs(j)
  1310.     endwhile
  1311.     k = j - 1
  1312.     ;Count back down, renumbering on the way
  1313.     while k > i
  1314.         BBSi = readbbs(k)
  1315.         writebbs(j, BBSi)
  1316.         j--
  1317.         k--
  1318.     endwhile
  1319.     writebbs(j, NewBBS)
  1320. endproc
  1321. #endif
  1322. #endif
  1323. #endif
  1324. #endif
  1325.  
  1326.  
  1327. #comment
  1328. *********************************************************************
  1329. * CHANGEMAILRUN()
  1330. * Calls filesave(), copymrn(), loadsettings()
  1331. * Called by: 
  1332. *     MRUN210A:  parsedialog()
  1333. *     MRUN210B:  main()
  1334. * Saves the last mailrun and loads a new one.
  1335. *********************************************************************
  1336. #endcomment
  1337.  
  1338. #ifdef MRUN210AB
  1339. proc changemailrun
  1340.     ;Update the last mailrun
  1341.     filesave()
  1342.     ;Get the next mailrun and copy it to the temp directory
  1343.     copymrn()
  1344.     loadsettings()
  1345. endproc
  1346. #endif
  1347.  
  1348.  
  1349. #comment
  1350. *********************************************************************
  1351. * CHECKPENDING()
  1352. * Calls readitem()
  1353. * Called by:
  1354. *     MRUN210H:  changestatus()
  1355. *     MRUN210G:  makequeue()
  1356. * Checks a BBS for currently pending items.  Returns "1" if
  1357. * items are pending, "0" if none are pending.
  1358. *********************************************************************
  1359. #endcomment
  1360.  
  1361. #ifdef MRUN210AG
  1362. func checkpending : string
  1363. string Pending = "0"
  1364. integer i
  1365.     i = 1
  1366.     Item = readitem(i)
  1367.     while not NULLSTR Item
  1368.         strextract pending Item "," 0
  1369.         if strcmpi Pending "1"
  1370.             exitwhile
  1371.         endif
  1372.         i++
  1373.         Item = readitem(i)
  1374.     endwhile
  1375.     return Pending
  1376. endfunc
  1377. #endif
  1378.  
  1379.  
  1380. #comment
  1381. *********************************************************************
  1382. * CHECKPERM()
  1383. * Called by:
  1384. *     MRUN210D:  main()
  1385. *     MRUN210E:  insertulfile()
  1386. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1387. * Checks the Temporary/Permanent radiobutton set; returns
  1388. * 1 if Permanent (button 1) is selected, 0 if Temporary
  1389. * (button 2).
  1390. *********************************************************************
  1391. #endcomment
  1392.  
  1393. #ifndef MRUN210AG
  1394. #ifndef MRUN210C
  1395. #ifndef MRUN210B
  1396. func checkperm : string
  1397. string Perm
  1398.     if PermRadio == 1
  1399.         Perm = "1"
  1400.     else
  1401.         Perm = "0"
  1402.     endif
  1403.     return Perm
  1404. endfunc
  1405. #endif
  1406. #endif
  1407. #endif
  1408.  
  1409.  
  1410. #comment
  1411. *********************************************************************
  1412. * CHECKCHILD()
  1413. * Called by:
  1414. *     MRUN210A-G:  main()
  1415. * Halts the script if the current script has not been
  1416. * called by another script.
  1417. *********************************************************************
  1418. #endcomment
  1419.  
  1420. proc checkchild
  1421.     if not ($CHILD || $CHAINED)
  1422.         errormsg "This script can only be run from MRUN210.WAX."
  1423.         halt
  1424.     endif
  1425. endproc
  1426.  
  1427.  
  1428. #comment
  1429. *********************************************************************
  1430. * CHECKRUNNING()
  1431. * Called by:
  1432. *     MRUN210H:  filenewmrun()
  1433. * Checks whether a mailrun is executing.  Returns 0 and
  1434. * generates a message if running, returns 1 if not.
  1435. *********************************************************************
  1436. #endcomment
  1437.  
  1438. #ifndef MRUN210G
  1439. func checkrunning : integer
  1440.     if FLAGS & RUNNING
  1441.         usermsg "You cannot create a new mailrun while a mailrun is executing."
  1442.         return 0
  1443.     else
  1444.         return 1
  1445.     endif
  1446. endfunc
  1447. #endif
  1448.  
  1449.  
  1450. #comment
  1451. *********************************************************************
  1452. * CHECKCHANGED()
  1453. * Called by:
  1454. *     MRUN210H:  filenewmrun(), cfgmrun(), cfgbbs(), cfgprompts(),
  1455. *                   cfgmaildoor(), defaultsmailrun(), defaultsbbs(),
  1456. *                   defaultsprompts(), defaultsdoor(), addnewbbs(),
  1457. *                   addgetsend(), adddownload(), addupload(), 
  1458. *                   addsendcmd(), addscript(), helpabout()
  1459. *     MRUN210B:  main()
  1460. *     MRUN210C:  changebbsinfo(), changeprompts(), changemaildoor()
  1461. *     MRUN210E:  main()
  1462. * Checks whether the contents of the current dialog box
  1463. * have changed and generates a warning.  Returns 1 if
  1464. * user elects to proceed or if there has been no change,
  1465. * 0 if user cancels.
  1466. *********************************************************************
  1467. #endcomment
  1468.  
  1469. func checkchanged : integer
  1470. integer Response
  1471.     if FLAGS & CHANGED
  1472.         sdlgmsgbox "MailRun Message" "Discard Changes?" QUESTION YESNO \
  1473.             Response 2
  1474.         switch Response
  1475.             case 6
  1476.                 FLAGS &= UNCHANGED
  1477.                 return 1
  1478.             endcase
  1479.             case 7
  1480.                 return 0
  1481.             endcase
  1482.         endswitch
  1483.     else
  1484.         return 1
  1485.     endif
  1486. endfunc
  1487.  
  1488.  
  1489. #comment
  1490. *********************************************************************
  1491. * CHECKFILE()
  1492. * Called by:
  1493. *     MRUN210A:  initialize()
  1494. *     MRUN210D:  purgeoldfiles(), getnewfiles(), import()
  1495. *     MRUN210E:  main(), getulfiles()
  1496. *     MRUN210G:  senddesc(), putdesc()
  1497. * Checks for a file's existence.  Returns 1 if the file is
  1498. * found, 0 if not found.
  1499. *********************************************************************
  1500. #endcomment
  1501.  
  1502. #ifndef MRUN210BC
  1503. #ifndef MRUN210F
  1504. func checkfile : integer
  1505. strparm FileNom
  1506.     if isfile FileNom
  1507.         return 1
  1508.     else
  1509.         return 0
  1510.     endif
  1511. endfunc
  1512. #endif
  1513. #endif
  1514.  
  1515.  
  1516. #comment
  1517. *********************************************************************
  1518. * CHECKTASK()
  1519. * Called by:
  1520. *     MRUN210H:  executearchiver(), executeqwkreader(),
  1521. *                   executelogviewer()
  1522. * Returns 1 if the specified application is already running;
  1523. * otherwise returns 0.
  1524. *********************************************************************
  1525. #endcomment
  1526.  
  1527. func checktask : integer
  1528. strparm Called
  1529. string AppName
  1530. integer i
  1531.     firsttask i
  1532.     while i
  1533.         taskname i AppName
  1534.         if strfind Called AppName
  1535.             return i
  1536.         endif
  1537.         nexttask i
  1538.     endwhile
  1539.     return 0
  1540. endfunc
  1541.  
  1542.  
  1543. #comment
  1544. *********************************************************************
  1545. * CHECKNEW()
  1546. * Called by:
  1547. *     MRUN210H:  cfgbbs(), cfgprompts(), cfgmaildoor(), 
  1548. *                   addgetsend(), adddlfile(), addulfile(),
  1549. *                   addsendcmd(), addscript()
  1550. * Returns 0 if the current mailrun is empty; else returns 1.
  1551. *********************************************************************
  1552. #endcomment
  1553.  
  1554. func checknew : integer
  1555.     if NULLSTR TaskItem
  1556.         usermsg "You must add a BBS before selecting this function!"
  1557.         return 0
  1558.     else
  1559.         return 1
  1560.     endif
  1561. endfunc
  1562.  
  1563.  
  1564. #comment
  1565. *********************************************************************
  1566. * MENUDIM()
  1567. * Called by:
  1568. *     MRUN210H:  callscript()
  1569. *     MRUN210B-G:  main()
  1570. * Enables all menu controls, then disables those which
  1571. * cannot be used in the current module.
  1572. *********************************************************************
  1573. #endcomment
  1574.  
  1575. proc menudim
  1576.     enable MENU 1 32
  1577. #ifndef MRUN210AG
  1578.     disable MENU 3 5
  1579.     disable MENU 8 11
  1580. #endif
  1581. #ifdef MRUN210G
  1582.     disable MENU 1
  1583.     disable MENU 3
  1584.     disable MENU 5 6
  1585. #endif
  1586. endproc
  1587.  
  1588.  
  1589. #comment
  1590. *********************************************************************
  1591. * SORTIDX()
  1592. * Calls fieldcompare(), makefullname(), openfile(),
  1593. * interfaceoff(), interfaceon()
  1594. * Called by:
  1595. *     MRUN210D:  main(), getnewfiles()
  1596. *     MRUN210E:  main(), getulfiles(), updateudx()
  1597. * Sorts an index file for display in the upload or download
  1598. * dialog box.  This routine uses two temp files to sort the
  1599. * contents of the referenced file.  It is used to sort an
  1600. * index file that has not been previously sorted.  The
  1601. * method used is too slow when only a couple of new items
  1602. * need to be sorted in the file.
  1603. *********************************************************************
  1604. #endcomment
  1605.  
  1606. #ifdef MRUN210DE
  1607. proc sortidx
  1608. strparm idxName
  1609. intparm SortField
  1610. string temp1, temp2, Line1, Line2, LastLine
  1611. integer Unsorted, Readidx, Writeidx, i, counter
  1612.     SortField -=2
  1613.     if SortField < 0
  1614.         return
  1615.     endif
  1616.     interfaceoff()
  1617.     counter = 0
  1618.     temp1 = makefullname(TempDir, "temp1.tmp")
  1619.     temp2 = makefullname(TempDir, "temp2.tmp")
  1620.     Unsorted = 0
  1621.     Readidx = 1
  1622.     Writeidx = 2
  1623.     openfile(Unsorted, idxName, _READWRITE, _TEXT)
  1624.     fgets Unsorted Line1
  1625.     statmsg "Sorting...     %d" counter
  1626.     if feof Unsorted
  1627.         ;if the index is empty, return
  1628.         fclose Unsorted
  1629.         interfaceon()
  1630.         return
  1631.     else
  1632.         ;otherwise, open temp files and sort
  1633.         openfile(Readidx, temp1, _CREATE, _TEXT)
  1634.         openfile(Writeidx, temp2, _CREATE, _TEXT)
  1635.         ;put the first line into the read file
  1636.         fputs Readidx Line1
  1637.         rewind Readidx
  1638.         ;get the next line of the unsorted file
  1639.         fgets Unsorted Line1
  1640.         counter++
  1641.         statmsg "Sorting...     %d" counter
  1642.         fgets Readidx Line2
  1643.         if feof Unsorted
  1644.             ;prevents a single file from being deleted
  1645.             fputs Writeidx Line2
  1646.         endif
  1647.         while not feof Unsorted
  1648.             while not feof Readidx
  1649.                 if fieldcompare(Line1, Line2, SortField)
  1650.                     exitwhile
  1651.                 endif
  1652.                 fputs Writeidx Line2
  1653.                 fgets Readidx Line2
  1654.             endwhile
  1655.             fputs Writeidx Line1
  1656.             LastLine = Line1
  1657.             fgets Unsorted Line1
  1658.             counter++
  1659.             statmsg "Sorting...     %d" counter
  1660.             if feof Unsorted
  1661.                 while not feof Readidx
  1662.                     fputs Writeidx Line2
  1663.                     fgets Readidx Line2
  1664.                 endwhile
  1665.                 exitwhile
  1666.             elseif !(fieldcompare(Line1, LastLine, SortField))
  1667.                 loopwhile
  1668.             endif
  1669.             while not feof Readidx
  1670.                 fputs Writeidx Line2
  1671.                 fgets Readidx Line2
  1672.             endwhile
  1673.             rewind Readidx
  1674.             rewind Writeidx
  1675.             i = Readidx
  1676.             Readidx = Writeidx
  1677.             Writeidx = i
  1678.             fgets Readidx Line2
  1679.         endwhile
  1680.         fclose Unsorted
  1681.         fclose Readidx
  1682.         fclose Writeidx
  1683.         delfile idxName
  1684.         if Writeidx == 1
  1685.             copyfile temp1 idxName
  1686.         else
  1687.             copyfile temp2 idxName
  1688.         endif
  1689.         delfile temp1
  1690.         delfile temp2
  1691.     endif
  1692.     statmsg ""
  1693.     interfaceon()
  1694. endproc
  1695. #endif
  1696.  
  1697.  
  1698. #comment
  1699. *********************************************************************
  1700. * FIELDCOMPARE()
  1701. * Called by:
  1702. *     MRUN210H:  sortidx()
  1703. * Compares two fields.  Returns 0 if Field1 > Field2,
  1704. * 1 if Field1 <= Field2.
  1705. *********************************************************************
  1706. #endcomment
  1707.  
  1708. #ifdef MRUN210DE
  1709. func fieldcompare : integer
  1710. strparm Line1, Line2
  1711. intparm FieldType
  1712. string Field1, Field2
  1713. long number1, number2, Date1, Date2
  1714.     strextract Field1 Line1 "`t" FieldType
  1715.     strextract Field2 Line2 "`t" FieldType
  1716.     switch FieldType
  1717.         case ALPHA
  1718.             strcmpi Field1 Field2
  1719.             if $STRCMP >= 0
  1720.                 return 0
  1721.             else
  1722.                 return 1
  1723.             endif
  1724.         endcase
  1725.         case NUMERIC
  1726.             atol Field1 number1
  1727.             atol Field2 number2
  1728.             if number1 >= number2
  1729.                 return 0
  1730.             else
  1731.                 return 1
  1732.             endif
  1733.         endcase
  1734.         case MMDDYY
  1735.             strsltime Field1 "00:00:00" Date1
  1736.             strsltime Field2 "00:00:00" Date2
  1737.             if Date1 >= Date2
  1738.                 return 0
  1739.             else
  1740.                 return 1
  1741.             endif
  1742.         endcase
  1743.     endswitch
  1744. endfunc
  1745. #endif
  1746.  
  1747.  
  1748. #comment
  1749. *********************************************************************
  1750. * FINDSTRING()
  1751. * Called by:
  1752. *     MRUN210B:  main()
  1753. *     MRUN210C:  exportprompts()
  1754. *     MRUN210D:  getnewfiles(), import()
  1755. *     MRUN210E:  shortdesc()
  1756. *     MRUN210G:  main(), checkcommandprompt(), getconfprompt(),
  1757. *                   checkmailprompt(), checkdescprompt(), 
  1758. *                   checkbaseset(), getotherprompt(), sendmail(),
  1759. *                   getmail(), checkmail(), ulfile(), checkverifyprompt(),
  1760. *                   senddesc(), dlfile(), sendcommand(), sendscript()
  1761. * Returns a value of 1 if the second string is contained
  1762. * in the first string; otherwise returns 0.
  1763. *********************************************************************
  1764. #endcomment
  1765.  
  1766. #ifndef MRUN210A
  1767. #ifndef MRUN210F
  1768. func findstring : integer
  1769. strparm String1, String2
  1770. integer i = 0
  1771.     if not NULLSTR String2
  1772.         if strfind String1 String2
  1773.             i = 1
  1774.         endif
  1775.     endif
  1776.     return i
  1777. endfunc
  1778. #endif
  1779. #endif
  1780.  
  1781.  
  1782. #comment
  1783. **************************************************************************
  1784. **************************************************************************
  1785. * The following routines comprise the user interface of MailRun.
  1786. * parsedialog controls the behavior of the main mailrun dialog box,
  1787. * parsemenu() controls the menu and parseobject() controls the
  1788. * toolbar.  The menus and toolbar are defined in MRUN210A in the
  1789. * procedures mrunmenu(), which creates the main menu system, 
  1790. * runmenu(), which creates the alternate menu used when a mailrun
  1791. * is executing, and mrunwin(), which creates the toolbar.
  1792. **************************************************************************
  1793. **************************************************************************
  1794. #comment
  1795.  
  1796.  
  1797. #comment
  1798. *********************************************************************
  1799. * INTERFACEON()
  1800. * Calls parsemenu(), parseobject()
  1801. * Called by:
  1802. *     MRUN210H:  sortidx(), taskfileend()
  1803. *     MRUN210A:  main()
  1804. *     MRUN210B:  main()
  1805. *     MRUN210C:  changeuserinfo(), changeprompts(), changemaildoor()
  1806. *     MRUN210D:  main(), purgeoldfiles(), getnewfiles(), deldlfile()
  1807. *     MRUN210E:  main(), insertulfile(), getulfiles(), updateudx(),
  1808. *     MRUN210F:  addgetmail(), addsendcommand(), adddoscript()
  1809. *     MRUN210G:  makequeue(), getdialstring(), senddesc(), putdesc()
  1810. * Activate and deactivate the menu and iconbar.
  1811. *********************************************************************
  1812. #endcomment
  1813.  
  1814. proc interfaceon
  1815.     when menu call parsemenu
  1816.     when object call parseobject
  1817. endproc
  1818.  
  1819.  
  1820. #comment
  1821. *********************************************************************
  1822. * INTERFACEOFF()
  1823. * Called by:
  1824. *     MRUN210H:  sortidx(), taskfilefwd()
  1825. *     MRUN210D:  main(), purgeoldfiles(), getnewfiles(), deldlfile()
  1826. *     MRUN210E:  insertulfile(), geulfiles(), updateudx()
  1827. *     MRUN210G:  makequeue(), getdialstring(), senddesc(), putdesc()
  1828. * Activate and deactivate the menu and iconbar.
  1829. *********************************************************************
  1830. #endcomment
  1831.  
  1832. #ifndef MRUN210BC
  1833. #ifndef MRUN210F
  1834. proc interfaceoff
  1835.     clearwhen menu
  1836.     clearwhen object
  1837. endproc
  1838. #endif
  1839. #endif
  1840.  
  1841.  
  1842. #comment
  1843. *********************************************************************
  1844. * PARSEDIALOG()
  1845. * Calls changestatus(), changemailrun(), maketasklist(),
  1846. * getfirstitem(), gettaskstring(), getbbsi(), getitemi(),
  1847. * swapbbs(), swapitem()
  1848. * Called by
  1849. *  MRUN210A:  main(), executor()
  1850. *  MRUN210G:  main()
  1851. * Checks for dialog box selection and dispatches the
  1852. * appropriate task.
  1853. *********************************************************************
  1854. #endcomment
  1855.  
  1856. #ifdef MRUN210AG
  1857. proc parsedialog
  1858. integer dialogstatus, i, j, k
  1859. #ifdef MRUN210G
  1860. string LastBBS, LastItem
  1861.     LastBBS = BBS
  1862.     LastItem = Item
  1863. #endif
  1864.     dialogstatus = $DIALOG
  1865.     switch dialogstatus
  1866.         case 10
  1867.             ;User double clicked on an item
  1868.             changestatus()
  1869.             updatedlg 80
  1870.         endcase
  1871.         case 11
  1872.             ;User selected Alt-U to move an item up
  1873.             i = getbbsi()
  1874.             j = getitemi()
  1875.             if j == 0
  1876.                 ;if the selected TaskItem is a BBS
  1877.                 k = i - 1
  1878.                 swapbbs(i, k)
  1879.             else
  1880.                 ;if the selected TaskItem is an Item
  1881.                 j--
  1882.                 if swapitem(i, j)
  1883.                     TaskItem = gettaskstring(i, j)
  1884.                 endif
  1885.             endif
  1886.             updatedlg 80
  1887.         endcase
  1888.         case 12
  1889.             ;User selected Alt-I to move an item down
  1890.             i = getbbsi()
  1891.             j = getitemi()
  1892.             if j == 0
  1893.                 ;If the selected TaskItem is a BBS
  1894.                 k = i + 1
  1895.                 swapbbs(i, k)
  1896.             else
  1897.                 ;If the selected TaskItem is an Item
  1898.                 if swapitem(i, j)
  1899.                     j++
  1900.                     TaskItem = gettaskstring(i, j)
  1901.                 endif
  1902.             endif
  1903.             updatedlg 80
  1904.         endcase
  1905. #ifdef MRUN210A
  1906.         case 170
  1907.             ;User changed mailruns with combobox
  1908.             changemailrun()
  1909.             maketasklist()
  1910.             getfirstitem()
  1911.             updatedlg 80
  1912.         endcase
  1913. #endif
  1914.     endswitch
  1915. #ifdef MRUN210G
  1916.     makequeue()
  1917.     BBS = LastBBS
  1918.     Item = LastItem
  1919. #endif
  1920. endproc
  1921. #endif
  1922.  
  1923.  
  1924. #comment
  1925. *********************************************************************
  1926. * SWAPBBS()
  1927. * Calls readbbs(), writebbs(), maketasklist()
  1928. * Called by:
  1929. *  MRUN210H: parsedialog()
  1930. * Swaps two BBSs in the task list.
  1931. *********************************************************************
  1932. #endcomment
  1933.  
  1934. #ifdef MRUN210AG
  1935. proc swapbbs
  1936. intparm i, k
  1937. string OldBBS, BBSNamen
  1938.     OldBBS = readbbs(k)
  1939.     if not NULLSTR OldBBS
  1940.         ;Unless this is the last (or first) BBS, swap with the next BBS
  1941.         writebbs(i, OldBBS)
  1942.         writebbs(k, BBS)
  1943.         maketasklist()
  1944.         profilerd MailRun BBS "BBSName" BBSNamen
  1945.         strfmt TaskItem "%s`t`t`t%d`t%d" BBSNamen k 0
  1946.     endif
  1947. endproc
  1948. #endif
  1949.  
  1950.  
  1951. #comment
  1952. *********************************************************************
  1953. * SWAPITEM()
  1954. * Calls readitem(), writeitem(), gettaskstring(), taskfilefwd(),
  1955. * taskfileend()
  1956. * Called by:
  1957. *  MRUN210H: parsedialog()
  1958. * Swaps two Items in the task list.
  1959. *********************************************************************
  1960. #endcomment
  1961.  
  1962. #ifdef MRUN210AG
  1963. func swapitem : integer
  1964. intparm i, j
  1965. string Itemj, Iteml, TaskString
  1966. integer l
  1967.     l = j + 1
  1968.     Itemj = readitem(j)
  1969.     Iteml = readitem(l)
  1970.     if j == 0
  1971.         return 0
  1972.     endif
  1973.     if not NULLSTR Iteml
  1974.         ;Unless this is the last Item, swap with the next Item
  1975.         taskfilefwd(i, j)
  1976.         writeitem(j, Iteml)
  1977.         writeitem(l, Itemj)
  1978.         TaskString = gettaskstring(i, j)
  1979.         fputs TaskFile TaskString
  1980.         TaskString = gettaskstring(i, l)
  1981.         fputs TaskFile TaskString
  1982.         fgets OldTaskFile TaskString
  1983.         taskfileend()
  1984.         return 1
  1985.     else
  1986.         return 0
  1987.     endif
  1988. endfunc
  1989. #endif
  1990.  
  1991.  
  1992. #comment
  1993. *********************************************************************
  1994. * CHANGESTATUS()
  1995. * Calls getbbsi(), getitemi(), readitem(), writeitem(),
  1996. * maketasklist(), gettaskstring(), checkpending(), taskfilefwd()
  1997. * taskfileend()
  1998. * Called by:
  1999. *     MRUN210H:  parsedialog()
  2000. * Changes the pending/complete permanent/temporary status
  2001. * of the selected item on the task list.  Responds to user
  2002. * double-clicking on the item.
  2003. *********************************************************************
  2004. #endcomment
  2005.  
  2006. #ifdef MRUN210AG
  2007. proc changestatus
  2008. string Pending, Perm, BBSNamen
  2009. integer i, j, ItemC, ItemE, ItemR
  2010.     i = getbbsi()
  2011.     j = getitemi()
  2012.     if j == 0
  2013.         ;If the item is a BBS
  2014.         ;Check for pending items
  2015.         Pending = checkpending()
  2016.         if strcmpi Pending "0"
  2017.             ;If no items are pending, set all to pending status
  2018.             Pending = "1"
  2019.         else
  2020.             ;If at least one item is pending, set all to completed status
  2021.             Pending = "0"
  2022.         endif
  2023.         j = 1
  2024.         Item = readitem(j)
  2025.         ;Update all items
  2026.         while not NULLSTR Item
  2027.             strupdt Item Pending 0 1
  2028.             writeitem(j, Item)
  2029.             j++
  2030.             Item = readitem(j)
  2031.         endwhile
  2032.         maketasklist()
  2033.         profilerd MailRun BBS "BBSName" BBSNamen
  2034.         strfmt TaskItem "%s`t`t`t%d`t%d" BBSNamen i 0
  2035.     else
  2036.         ;If it is not a BBS
  2037.         Item = readitem(j)
  2038.         atoi ItemComplete ItemC
  2039.         atoi ItemRemaining ItemR
  2040.         atoi ItemError ItemE
  2041.         strextract Pending Item "," 0
  2042.         strextract Perm Item "," 1
  2043.         if not strcmpi Pending "1"
  2044.             if strcmpi Pending "0"
  2045.                 ItemC--
  2046.             else
  2047.                 ItemE--
  2048.             endif
  2049.             ItemR++
  2050.             Pending = "1"
  2051.             Perm = "0"
  2052.         else
  2053.             if strcmpi Perm "0"
  2054.                 Perm = "1"
  2055.             else
  2056.                 Pending = "0"
  2057.                 ItemC++
  2058.                 ItemR--
  2059.             endif
  2060.         endif
  2061.         itoa ItemC ItemComplete
  2062.         itoa ItemR ItemRemaining
  2063.         itoa ItemE ItemError
  2064.         strupdt Item Pending 0 1
  2065.         strupdt Item Perm 2 1
  2066.         taskfilefwd(i, j)
  2067.         writeitem(j, Item)
  2068.         TaskItem = gettaskstring(i, j)
  2069.         fputs TaskFile TaskItem
  2070.         taskfileend()
  2071.     endif
  2072. endproc
  2073. #endif
  2074.  
  2075.  
  2076. #comment
  2077. *********************************************************************
  2078. *
  2079. * TASKFILEFWD()
  2080. *
  2081. * Calls makefullname(), openfile(), interfaceoff()
  2082. *
  2083. * Called by:
  2084. *  MRUN210H:  swapitem(), changestatus()
  2085. *
  2086. * Opens the Task List file and moves forward to the designated
  2087. * coordinates.
  2088. *********************************************************************
  2089. #endcomment
  2090.  
  2091. #ifdef MRUN210AG
  2092. proc taskfilefwd
  2093. intparm i, j
  2094. string OldTasks, OldTaskString, TaskString
  2095.     interfaceoff()
  2096.     OldTasks = makefullname(TempDir, "oldtasks.tmp")
  2097.     copyfile TaskList OldTasks
  2098.     openfile(OldTaskFile, OldTasks, _READWRITE, _TEXT)
  2099.     openfile(TaskFile, TaskList, _CREATE, _TEXT)
  2100.     OldTaskString = gettaskstring(i, j)
  2101.     fgets OldTaskFile TaskString
  2102.     while not strcmpi OldTaskString TaskString
  2103.         fputs TaskFile TaskString
  2104.         fgets OldTaskFile TaskString
  2105.     endwhile
  2106. endproc
  2107. #endif
  2108.  
  2109.  
  2110. #comment
  2111. *********************************************************************
  2112. *
  2113. * TASKFILEEND()
  2114. *
  2115. * Calls makefullname(), interfaceon()
  2116. *
  2117. * Called by:
  2118. *  MRUN210H:  swapitem(), changestatus()
  2119. *
  2120. * Reads to the end of the Task List file and closes it.
  2121. *********************************************************************
  2122. #endcomment
  2123.  
  2124. #ifdef MRUN210AG
  2125. proc taskfileend
  2126. string TaskString, OldTasks
  2127.     fgets OldTaskFile TaskString
  2128.     while not feof OldTaskFile
  2129.         fputs TaskFile TaskString
  2130.         fgets OldTaskFile TaskString
  2131.     endwhile
  2132.     fclose OldTaskFile
  2133.     fclose TaskFile
  2134.     OldTasks = makefullname(TempDir, "oldtasks.tmp")
  2135.     delfile OldTasks
  2136.     interfaceon()
  2137. endproc
  2138. #endif
  2139.  
  2140.  
  2141. #comment
  2142. *********************************************************************
  2143. * PARSEMENU()
  2144. * Calls filenewmrun(), filesave(), filesaveas(), filereset(),
  2145. * filedelmrun(), fileautorun(), fileexit(), editcut(), editcopy(), 
  2146. * editpaste(), editdelete(), cfgmrun(), cfgbbs(), cfgprompts(), 
  2147. * cfgmaildoor(), defaultsmailrun(), defaultsbbs(), defaultsprompts(),
  2148. * defaultsdoor(), addnewbbs(), addgetsend(), addupload(),
  2149. * adddownload(), addsendcmd(), addscript(), executemailrun(),
  2150. * executeqwkreader(), executearchiver(), executelogviewer(),
  2151. * helpcontents(), helpcontext(), helpabout()
  2152. * Called by:
  2153. *     MRUN210H:  interfaceon()
  2154. * Parses a selection from the MailRun menu.
  2155. *********************************************************************
  2156. #endcomment
  2157.  
  2158. proc parsemenu
  2159. integer menustatus
  2160.     menustatus = $MENU
  2161.     switch menustatus
  2162. #ifndef MRUN210G
  2163.         case 1
  2164.             ;User selected file.new
  2165.             filenewmrun()
  2166.         endcase
  2167. #endif
  2168.         case 2
  2169.             ;User selected file.save
  2170.             filesave()
  2171.         endcase
  2172. #ifdef MRUN210A
  2173.         case 3
  2174.             ;User selected file.save_as
  2175.             filesaveas()
  2176.         endcase
  2177. #endif
  2178. #ifdef MRUN210AG
  2179.         case 4
  2180.             ;User selected file.reset
  2181.             filereset()
  2182.         endcase
  2183. #endif
  2184. #ifdef MRUN210A
  2185.         case 5
  2186.             ;User selected file.delete_mailrun
  2187.             filedelmrun()
  2188.         endcase
  2189. #endif
  2190. #ifndef MRUN210G
  2191.         case 6
  2192.             ;User selected file.create_autorun
  2193.             fileautorun()
  2194.         endcase
  2195. #endif
  2196.         case 7
  2197.             ;User selected file.exit
  2198.             fileexit()
  2199.         endcase
  2200. #ifdef MRUN210AG
  2201.         case 8
  2202.             ;User selected edit.cut
  2203.             editcut()
  2204.         endcase
  2205.         case 9
  2206.             ;User selected edit.copy
  2207.             editcopy()
  2208.         endcase
  2209.         case 10
  2210.             ;User selected edit.paste
  2211.             editpaste()
  2212.         endcase
  2213.         case 11
  2214.             ;User selected delete_item
  2215.             editdelete()
  2216.         endcase
  2217. #endif
  2218.         case 12
  2219.             ;User selected configure.mailrun_settings
  2220.             cfgmrun()
  2221.         endcase
  2222.         case 13
  2223.             ;User selected configure.bbs_settings
  2224.             cfgbbs()
  2225.         endcase
  2226.         case 14
  2227.             ;User selected configure.bbs_prompts
  2228.             cfgprompts()
  2229.         endcase
  2230.         case 15
  2231.             ;User selected configure.bbs_mail_door
  2232.             cfgmaildoor()
  2233.         endcase
  2234.         case 16
  2235.             ;User selected configure.defaults.mailrun
  2236.             defaultsmailrun()
  2237.         endcase
  2238.         case 17
  2239.             ;User selected configure.defaults.bbs
  2240.             defaultsbbs()
  2241.         endcase
  2242.         case 18
  2243.             ;User selected configure.defaults.prompts
  2244.             defaultsprompts()
  2245.         endcase
  2246.         case 19
  2247.             ;User selected configure.defaults.maildoor
  2248.             defaultsdoor()
  2249.         endcase
  2250.         case 20
  2251.             ;User selected add.new_bbs
  2252.             addnewbbs()
  2253.         endcase
  2254.         case 21
  2255.             ;User selected add.get/send_mail
  2256.             addgetsend()
  2257.         endcase
  2258.         case 22
  2259.             ;User selected add.upload_file
  2260.             addupload()
  2261.         endcase
  2262.         case 23
  2263.             ;User selected add.download_file
  2264.             adddownload()
  2265.         endcase
  2266.         case 24
  2267.             ;User selected add.send_command
  2268.             addsendcmd()
  2269.         endcase
  2270.         case 25
  2271.             ;User selected add.execute_script
  2272.             addscript()
  2273.         endcase
  2274.         case 26
  2275.             ;User selected execute.mailrun
  2276.             executemailrun()
  2277.         endcase
  2278.         case 27
  2279.             ;User selected execute.qwk_reader
  2280.             executeqwkreader()
  2281.         endcase
  2282.         case 28
  2283.             ;User selected execute.archiver
  2284.             executearchiver()
  2285.         endcase
  2286.         case 29
  2287.             ;User selected execute.view_log_file
  2288.             executelogviewer()
  2289.         endcase
  2290.         case 30
  2291.             ;User selected help.contents
  2292.             helpcontents()
  2293.         endcase
  2294.         case 31
  2295.             ;User selected help.current_window
  2296.             helpcontext()
  2297.         endcase
  2298.         case 32
  2299.             ;User selected help.about
  2300.             helpabout()
  2301.         endcase
  2302.     endswitch
  2303. endproc
  2304.  
  2305.  
  2306. #comment
  2307. *********************************************************************
  2308. * PARSEOBJECT()
  2309. * Calls executemailrun(), filereset(), filenewmrun(), 
  2310. * cfgbbs(), addnewbbs(), addgetsend(), addupload(),
  2311. * adddownload(), addsendcmd(), addscript(), editdelete(),
  2312. * executelogviewer(), executeqwkreader(), executearchiver(), 
  2313. * fileexit(), helpabout()
  2314. * Called by:
  2315. *     MRUN210H:  interfaceon()
  2316. * Parses a selection from the MailRun icon bar.
  2317. *********************************************************************
  2318. #endcomment
  2319.  
  2320. proc parseobject
  2321. integer objectstatus
  2322.     objectstatus = $OBJECT
  2323.     switch objectstatus
  2324.         case 1
  2325.             ;User selected icon for execute.mailrun
  2326.             executemailrun()
  2327.         endcase
  2328. #ifdef MRUN210AG
  2329.         case 2
  2330.             ;User selected icon for file.reset
  2331.             filereset()
  2332.         endcase
  2333. #endif
  2334. #ifndef MRUN210G
  2335.         case 3
  2336.             ;User selected icon for file.new
  2337.             filenewmrun()
  2338.         endcase
  2339. #endif
  2340.         case 4
  2341.             ;User selected icon for configure.bbs
  2342.             cfgbbs()
  2343.         endcase
  2344.         case 5
  2345.             ;User selected icon for add.new_bbs
  2346.             addnewbbs()
  2347.         endcase
  2348.         case 6
  2349.             ;User selected icon for add.get/send_mail
  2350.             addgetsend()
  2351.         endcase
  2352.         case 7
  2353.             ;User selected icon for add.upload_file
  2354.             addupload()
  2355.         endcase
  2356.         case 8
  2357.             ;User selected icon for add.download_file
  2358.             adddownload()
  2359.         endcase
  2360.         case 9
  2361.             ;User selected icon for add.send_command
  2362.             addsendcmd()
  2363.         endcase
  2364.         case 10
  2365.             ;User selected icon for add.execute_script
  2366.             addscript()
  2367.         endcase
  2368. #ifdef MRUN210AG
  2369.         case 11
  2370.             ;User selected icon for file.delete_item
  2371.             editdelete()
  2372.         endcase
  2373. #endif
  2374.         case 12
  2375.             ;User selected icon for execute.view_log_file
  2376.             executelogviewer()
  2377.         endcase
  2378.         case 13
  2379.             ;User selected icon for execute.qwk_reader
  2380.             executeqwkreader()
  2381.         endcase
  2382.         case 14
  2383.             ;User selected icon for execute.archiver
  2384.             executearchiver()
  2385.         endcase
  2386.         case 15
  2387.             ;User selected icon for file.exit
  2388.             fileexit()
  2389.         endcase
  2390.         case 16
  2391.             ;User selected icon for context sensitive help
  2392.             helpcontext()
  2393.         endcase
  2394.     endswitch
  2395. endproc
  2396.  
  2397.  
  2398. #comment
  2399. **************************************************************************
  2400. **************************************************************************
  2401. * The following procedures correspond to menu selections
  2402. * and are called from parsemenu() and parseobject().
  2403. **************************************************************************
  2404. **************************************************************************
  2405. #endcomment
  2406.  
  2407.  
  2408. #comment
  2409. *********************************************************************
  2410. * FILENEWMRUN()
  2411. * Calls checkrunning(), checkchanged(), makefullname(),
  2412. * callscript(), MRUN210B\main()
  2413. * Called by:
  2414. *     MRUN210H:  parsemenu(), parseobject()
  2415. *     
  2416. * Corresponds to File.New_MailRun menu selection.  Creates a 
  2417. * new mailrun.
  2418. *     
  2419. *********************************************************************
  2420. #endcomment
  2421.  
  2422. #ifndef MRUN210G
  2423. proc filenewmrun
  2424. #ifndef MRUN210B
  2425. string changesettings
  2426. #endif
  2427.     if checkrunning() && checkchanged()
  2428.         FLAGS = NEW
  2429. #ifndef MRUN210B
  2430.         changesettings = makefullname(MailRunDir, "MRUN210B")
  2431.         callscript(changesettings)
  2432. #else
  2433.         main()
  2434. #endif
  2435.     endif
  2436. endproc
  2437. #endif
  2438.  
  2439.  
  2440. #comment
  2441. *********************************************************************
  2442. * FILESAVE()
  2443. * Calls makefullname()
  2444. * Called by:
  2445. *     MRUN210H:  parsemenu(), makemrn(), changemailrun(), fileexit()
  2446. *     MRUN210B:  newmailrun()
  2447. * Corresponds to the File.Save menu selection.  Saves the 
  2448. * current mailrun.
  2449. *     
  2450. *********************************************************************
  2451. #endcomment
  2452.  
  2453. proc filesave
  2454. string LastRun
  2455.     if !(FLAGS & DEFAULTS)
  2456.         findfirst MailRun
  2457.         LastRun = makefullname(MailRunDir, $FILENAME)
  2458.         if not NULLSTR $FILENAME
  2459.             delfile LastRun
  2460.         endif
  2461.         copyfile MailRun LastRun
  2462.         profilewr MailRunIni "MailRun" "MailRun" $FILENAME
  2463.     endif
  2464. endproc
  2465.  
  2466.  
  2467. #comment
  2468. *********************************************************************
  2469. * FILESAVEAS()
  2470. * Calls fverify(), makefullname(), copymrn(), makemailrunlist()
  2471. * Called by:
  2472. *     MRUN210H:  parsemenu()
  2473. * Corresponds to the File.Save_AS menu selection.  Saves the
  2474. * current mailrun under a new name and makes the new mailrun
  2475. * current.
  2476. *********************************************************************
  2477. #endcomment
  2478.  
  2479. #ifdef MRUN210A
  2480. proc filesaveas
  2481. string NewRun, temp
  2482. integer Response
  2483.     ;Make sure the entered MailRun ID is the correct length
  2484.     ;and that it doesn't already exist
  2485.     while 1
  2486.         NewRun = ""
  2487.         sdlginput "New MailRun" \
  2488.             "Save the current mailrun as:" NewRun
  2489.         if FAILURE
  2490.             exit
  2491.         endif
  2492.         strlwr NewRun
  2493.         if not fverify(NewRun)
  2494.             usermsg \
  2495.             "A mailrun ID must be a valid DOS file name without the extension."
  2496.             loopwhile
  2497.         endif
  2498.         strfmt temp "%s.mrn" NewRun
  2499.         NewRun = makefullname(MailRunDir, temp)
  2500.         if isfile NewRun
  2501.             sdlgmsgbox "MailRun Message" \
  2502.                 "%s already exists!`r`n`r`nReplace it?" QUESTION YESNO Response 2
  2503.             if Response == 7
  2504.                 ;if user selected "No"
  2505.                 NewRun = ""
  2506.                 loopwhile
  2507.             endif
  2508.         endif
  2509.         exitwhile
  2510.     endwhile
  2511.     delfile NewRun
  2512.     MailRunTrunc = temp
  2513.     copyfile MailRun NewRun
  2514.     copymrn()
  2515.     makemailrunlist()
  2516.     updatedlg 512
  2517. endproc
  2518. #endif
  2519.  
  2520.  
  2521. #comment
  2522. *********************************************************************
  2523. * FILERESET()
  2524. * Calls maketasklist(), getfirstitem(), readbbs(), readitem(),
  2525. * writeitem()
  2526. * Called by:
  2527. *     MRUN210H:  parsemenu(), parseobject(), filereset()
  2528. * Corresponds to the File.Reset_MailRun menu selection.
  2529. * Resets completed permenant items to pending.  Deletes
  2530. * completed temporary items.
  2531. *********************************************************************
  2532. #endcomment
  2533.  
  2534. #ifdef MRUN210AG
  2535. proc filereset
  2536. string Pending, Perm
  2537. integer p1, p2, i, j, k
  2538.     i = 1
  2539.     BBS = readbbs(i)
  2540.     ;Loop through each BBS
  2541.     while not NULLSTR BBS
  2542.         j = 1
  2543.         k = 1
  2544.         Item = readitem(j)
  2545.         ;Loop through each Item
  2546.         while not NULLSTR Item
  2547.             ;Clear the old item
  2548.             writeitem(j, "")
  2549.             strextract pending Item "," 0
  2550.             strextract perm Item "," 1
  2551.             atoi pending p1
  2552.             atoi perm p2
  2553.  
  2554.             ;Items that are completed and temporary will not be updated
  2555.             ;The second counter "k" is required to avoid gaps where items
  2556.             ;are deleted.
  2557.  
  2558.             if (p1 != 0) || (p2 != 0)
  2559.                 strupdt Item "1" 0 1
  2560.                 writeitem(k, Item)
  2561.                 k++
  2562.             endif
  2563.             j++
  2564.             Item = readitem(j)
  2565.         endwhile
  2566.         i++
  2567.         BBS = readbbs(i)
  2568.     endwhile
  2569.     maketasklist()
  2570.     getfirstitem()
  2571.     updatedlg 80
  2572. endproc
  2573. #endif
  2574.  
  2575.  
  2576. #comment
  2577. *********************************************************************
  2578. * FILEDELMRUN()
  2579. * Calls makefullname(), copymrn(), makemailrunlist(),
  2580. * maketasklist(), getfirstitem()
  2581. * Called by:
  2582. *     MRUN210H:  parsemenu()
  2583. * Corresponds to the File.Delete_MailRun menu selection.
  2584. * Deletes the current mailrun and makes the next available
  2585. * mailrun current.
  2586. *********************************************************************
  2587. #endcomment
  2588.  
  2589. #ifdef MRUN210A
  2590. proc filedelmrun
  2591. string LastMRun
  2592.     findfirst MailRun
  2593.     LastMRun = makefullname(MailRunDir, $FILENAME)
  2594.     delfile LastMRun
  2595.     LastMRun = makefullname(MailRunDir, "*.MRN")
  2596.     findfirst LastMRun
  2597.     MailRunTrunc = $FILENAME
  2598.     copymrn()
  2599.     makemailrunlist()
  2600.     maketasklist()
  2601.     getfirstitem()
  2602.     updatedlg -1
  2603. endproc
  2604. #endif
  2605.  
  2606.  
  2607. #comment
  2608. *********************************************************************
  2609. * FILEAUTORUN()
  2610. * Calls makefullname(), openfile()
  2611. * Called by:
  2612. *     MRUN210H:  parsemenu()
  2613. * Corresponds to the File.Create_AutoRun menu selection.
  2614. * Creates an AutoRun script file.
  2615. *********************************************************************
  2616. #endcomment
  2617.  
  2618. #ifndef MRUN210G
  2619. proc fileautorun
  2620. string AutoRunFile
  2621.     findfirst MailRun
  2622.     AutoRunFile = makefullname(MailRunDir, $FNAME)
  2623.     strcat AutoRunFile ".WAS"
  2624.     openfile(0, AutoRunFile, _CREATE, _TEXT)
  2625.     fstrfmt 0 ";MailRun autostart script for %s`r`n`r`n" MailRunTrunc
  2626.     fputs 0 "proc main"
  2627.     fputs 0 "string MailRunIni"
  2628.     fputs 0 "`tMailRunIni = $WINPATH"
  2629.     fputs 0 "`taddfilename MailRunIni `"MAILRUN.INI`""
  2630.     fputs 0 "`tprofilewr MailRunIni `"MailRun`" `"AutoRun`" 1"
  2631.     fstrfmt 0 "`tprofilewr MailRunIni `"MailRun`" `"MailRun`" `"%s`"`r`n" \
  2632.         MailRunTrunc
  2633.     fputs 0 "`tchain `"MRUN210`""
  2634.     fputs 0 "endproc"
  2635.     fclose 0
  2636. endproc
  2637. #endif
  2638.  
  2639.  
  2640. #comment
  2641. *********************************************************************
  2642. * FILEEXIT()
  2643. * Calls filesave(), cleardir(), makefullname()
  2644. * Called by:
  2645. *     MRUN210H:  parsemenu(), parseobject(), openfile()
  2646. *     MRUN210A:  executor()
  2647. *     MRUN210B:  changemrundir()
  2648. *     MRUN210G:  dobbs()
  2649. * Corresponds to the File.Exit menu selection.  Restores
  2650. * system settings, deletes temporary files, and halts script.
  2651. *********************************************************************
  2652. #endcomment
  2653.  
  2654. proc fileexit
  2655. string StateCapPath, StateCapFile, StateDnldPath, StateUpldPath
  2656. string CleanupFile
  2657. integer StateAutoDL, StateActionBar, StateMetaKeys
  2658.  
  2659.     ;Update the last mailrun
  2660.     filesave()
  2661.  
  2662.     ;Retrieve the previous system state from the cleanup file
  2663.     cleanupfile = makefullname(TempDir, "CLEANUP.TMP")
  2664.     profilerd CleanupFile "Cleanup" "StateAutoDL" StateAutoDL
  2665.     profilerd CleanupFile "Cleanup" "StateCapPath" StateCapPath
  2666.     profilerd CleanupFile "Cleanup" "StateCapFile" StateCapFile
  2667.     profilerd CleanupFile "Cleanup" "StateDnldPath" StateDnldPath
  2668.     profilerd CleanupFile "Cleanup" "StateUpldPath" StateUpldPath
  2669.     profilerd CleanupFile "Cleanup" "StateActionBar" StateActionBar
  2670.     profilerd CleanupFile "Cleanup" "StateMetaKeys" StateMetaKeys
  2671.  
  2672.     ;Restore the settings
  2673.     capture OFF
  2674.     set capture path StateCapPath
  2675.     set capture file StateCapFile
  2676.     set dnldpath StateDnldPath
  2677.     set upldpath StateUpldPath
  2678.     set aspect rangechk ON
  2679.     if StateAutoDL != 0
  2680.         set autodnld ON
  2681.     endif
  2682.     if StateActionBar != 0
  2683.         actionbar ON
  2684.     endif
  2685.     if StateMetaKeys != 0
  2686.         metakeys ON
  2687.     endif
  2688.  
  2689.     cleardir(TempDir)
  2690.     chdir MailRunDir
  2691.     rmdir TempDir
  2692.     statmsg ""
  2693.     remove USERWIN
  2694. #ifdef MRUN210A
  2695.     if PostRun == 3
  2696.         closepw
  2697.     endif
  2698. #endif
  2699.     halt
  2700. endproc
  2701.  
  2702.  
  2703. #comment
  2704. *********************************************************************
  2705. * EDITCUT()
  2706. * Calls editcopy(), editdelete()
  2707. * Called by:
  2708. *     MRUN210H:  parsemenu()
  2709. * Corresponds to the Edit.Cut menu selection.  Copies the
  2710. * current item in the Task List to the clipboard and deletes
  2711. * it from the Task List.
  2712. *********************************************************************
  2713. #endcomment
  2714.  
  2715. #ifdef MRUN210AG
  2716. proc editcut
  2717.     editcopy()
  2718.     editdelete()
  2719. endproc
  2720. #endif
  2721.  
  2722.  
  2723. #comment
  2724. *********************************************************************
  2725. * EDITCOPY()
  2726. * Calls getbbsi(), getitemi(), makefullname(), loadbbsinfo(),
  2727. * loadprompts(), loadmaildoor(), writebbsinfo(), writeprompts(),
  2728. * writemaildoor(), readitem()
  2729. * Called by:
  2730. *     MRUN210H:  parsemenu(), editcut()
  2731. * Coresponds to the Edit.Copy menu selection.  Copies the 
  2732. * currently selected item in the Task List to the clipboard.
  2733. * If the item is a BBS, all user info and prompts are copied
  2734. * as well.
  2735. *********************************************************************
  2736. #endcomment
  2737.  
  2738. #ifdef MRUN210AG
  2739. proc editcopy
  2740. string LastBBS, LastItem, LastMRun, temp
  2741. integer i, j
  2742.     if NULLSTR TaskItem
  2743.         return
  2744.     endif
  2745.     LastBBS = BBS
  2746.     LastItem = Item
  2747.     LastMRun = MailRun
  2748.     i = getbbsi()
  2749.     j = getitemi()
  2750.     temp = makefullname(TempDir, "TEMP.TMP")
  2751.     ;If the current TaskItem is a BBS...
  2752.     if j == 0
  2753. #ifdef MRUN210G
  2754.         usermsg "Cannot copy/cut a BBS while a mailrun is executing!"
  2755. #else
  2756.         loadbbsinfo()
  2757.         loadprompts()
  2758.         loadmaildoor()
  2759.         MailRun = temp
  2760.         profilewr temp "MailRun Data" "BBS" BBS
  2761.         writebbsinfo()
  2762.         writeprompts()
  2763.         writemaildoor()
  2764.         filetoclip TEXT temp
  2765. #endif
  2766.     else
  2767.         Item = readitem(j)
  2768.         profilewr temp "MailRun Data" "Item" Item
  2769.         filetoclip TEXT temp
  2770.     endif
  2771.     delfile temp
  2772.     MailRun = LastMRun
  2773.     BBS = LastBBS
  2774.     Item = LastItem
  2775. endproc
  2776. #endif
  2777.  
  2778.  
  2779. #comment
  2780. *********************************************************************
  2781. * EDITPASTE()
  2782. * Calls getbbsi(), getitemi(), makefullname(), gettaskstring(),
  2783. * insertitem(), makebbslist(), insertbbs(), loadbbsinfo(),
  2784. * loadprompts(), loadmaildoor(), writebbsinfo(), writeprompts(),
  2785. * writemaildoor(), maketasklist()
  2786. * Called by:
  2787. *     MRUN210H:  parsemenu()
  2788. * Corresponds to the Edit.Paste menu selection.  Pastes an
  2789. * item from the clipboard into the current mailrun.
  2790. *********************************************************************
  2791. #endcomment
  2792.  
  2793. #ifdef MRUN210AG
  2794. proc editpaste
  2795. string LastBBS, LastItem, LastMRun, temp
  2796. string NewBBS, NovumItem
  2797. integer i, j
  2798.     LastMRun = MailRun
  2799.     LastBBS = BBS
  2800.     LastItem = Item
  2801.     i = getbbsi()
  2802.     j = getitemi()
  2803.     temp = makefullname(TempDir, "TEMP.TMP")
  2804.     cliptofile TEXT temp
  2805.     profilerd temp "MailRun Data" "Item" NovumItem
  2806.     profilerd temp "MailRun Data" "BBS" NewBBS
  2807.     if not NULLSTR NovumItem
  2808.         if NULLSTR TaskItem
  2809.             usermsg "You must add a BBS first!"
  2810.             return
  2811.         endif
  2812.         insertitem(j, NovumItem)
  2813.         TaskItem = gettaskstring(i, j)
  2814.     elseif not NULLSTR NewBBS
  2815. #ifdef MRUN210G
  2816.         usermsg "Cannot paste a BBS while a mailrun is executing!"
  2817. #else
  2818.         makebbslist()
  2819.         if strfind BBSList NewBBS
  2820.             errormsg "That BBS is already in the MailRun!"
  2821.             return
  2822.         endif
  2823.         if not NULLSTR BBSList
  2824.             insertbbs(i, NewBBS)
  2825.         else
  2826.             i = 0
  2827.             profilewr MailRun "MailRun" "BBS_1" NewBBS
  2828.         endif
  2829.         BBS = NewBBS
  2830.         MailRun = temp
  2831.         loadbbsinfo()
  2832.         loadprompts()
  2833.         loadmaildoor()
  2834.         MailRun = LastMRun
  2835.         writebbsinfo()
  2836.         writeprompts()
  2837.         writemaildoor()
  2838.         i++
  2839.         strfmt TaskItem "%s`t`t`t%d`t0" BBSName i
  2840. #endif
  2841.     else
  2842.         usermsg "Nothing to paste!"
  2843.         return
  2844.     endif
  2845.     BBS = LastBBS
  2846.     Item = LastItem
  2847.     maketasklist()
  2848.     updatedlg 80
  2849. endproc
  2850. #endif
  2851.  
  2852.  
  2853. #comment
  2854. *********************************************************************
  2855. * EDITDELETE()
  2856. * Calls getbbsi(), getitemi(), readbbs(), readitem(),
  2857. * writebbs(), writeitem(), maketasklist(), makebbslist(),
  2858. * gettaskstring()
  2859. * Called by:
  2860. *     MRUN210H:  parsemenu(), parseobject(), editcut()
  2861. *     MRUN210A:  parsekeystate()
  2862. * Corresponds to the Edit.Delete menu selection.  Deletes
  2863. * the currently selected item in the Task List.
  2864. *********************************************************************
  2865. #endcomment
  2866.  
  2867. #ifdef MRUN210AG
  2868. proc editdelete
  2869. string BBSNamen, LastBBS, LastItem
  2870. integer i, j, k, l
  2871.     LastBBS = BBS
  2872.     LastItem = Item
  2873.     i = getbbsi()
  2874.     j = getitemi()
  2875.     if j == 0
  2876.         ;If the current TaskItem is a BBS...
  2877.         l = i
  2878.         k = l + 1
  2879.         BBS = readbbs(k)
  2880.  
  2881.         ;Decrement the BBS coordinate of each BBS after the one selected
  2882.  
  2883.         while not NULLSTR BBS
  2884.             writebbs(l, BBS)
  2885.             l++
  2886.             k++
  2887.             BBS = readbbs(k)
  2888.         endwhile
  2889.         writebbs(l, "")
  2890.         ;Update the task list
  2891.         maketasklist()
  2892.  
  2893.         ;Reset the TaskItem.  If the selected BBS was the last one
  2894.         ;in the list, set TaskItem to the previous BBS; otherwise,
  2895.         ;set it to the next BBS
  2896.  
  2897.         BBS = readbbs(i)
  2898.         if NULLSTR BBS
  2899.             i--
  2900.             BBS = readbbs(i)
  2901.             if NULLSTR BBS
  2902.                 TaskItem = ""
  2903.             else
  2904.                 profilerd MailRun BBS "BBSName" BBSNamen
  2905.                 strfmt TaskItem "%s`t`t`t%d`t%d" BBSNamen i 0
  2906.             endif
  2907.         else
  2908.             profilerd MailRun BBS "BBSName" BBSNamen
  2909.             strfmt TaskItem "%s`t`t`t%d`t%d" BBSNamen i 0
  2910.         endif
  2911.  
  2912.     else
  2913.         ;If the current TaskItem is an Item
  2914.         l = j
  2915.         k = l + 1
  2916.  
  2917.         ;Decrement the Item coordinate of each item after the one selected
  2918.  
  2919.         Item = readitem(k)
  2920.         while not NULLSTR Item
  2921.             writeitem(l, Item)
  2922.             l++
  2923.             k++
  2924.             Item = readitem(k)
  2925.         endwhile
  2926.         writeitem(l, "")
  2927.         ;Update the task list
  2928.         maketasklist()
  2929.  
  2930.         ;Reset the TaskItem to the next Item for that BBS.  If the selected
  2931.         ;Item was the last one for that BBS, set TaskItem to the previous
  2932.         ;Item.  If it was the only item for that BBS, set it to the BBS name.
  2933.  
  2934.         BBS = readbbs(i)
  2935.         Item = readitem(j)
  2936.         if not NULLSTR Item
  2937.             ;If it wasn't the last item...
  2938.             TaskItem = gettaskstring(i, j)
  2939.         elseif j == 1
  2940.             ;If it was the only item...
  2941.             profilerd MailRun BBS "BBSName" BBSNamen
  2942.             strfmt TaskItem "%s`t`t`t%d`t%d" BBSNamen i 0
  2943.         else
  2944.             ;If it was the last of multiple items...
  2945.             j--
  2946.             Item = readitem(j)
  2947.             TaskItem = gettaskstring(i, j)
  2948.         endif
  2949.     endif
  2950.     if FLAGS & RUNNING
  2951.         BBS = LastBBS
  2952.         Item = LastItem
  2953.     endif
  2954.     updatedlg 80
  2955. endproc
  2956. #endif
  2957.  
  2958.  
  2959. #comment
  2960. *********************************************************************
  2961. * CFGMRUN()
  2962. * Calls checkchanged(), configmrun()
  2963. * Called by:
  2964. *     MRUN210H:  parsemenu()
  2965. * Corresponds to the Configure.MailRun_Settings menu selection.
  2966. *********************************************************************
  2967. #endcomment
  2968.  
  2969. proc cfgmrun
  2970.     if checkchanged()
  2971.         ;reset all flags except RUNNING
  2972.         FLAGS &= RUNNING
  2973.         configmrun()
  2974.     endif
  2975. endproc
  2976.  
  2977.  
  2978. #comment
  2979. *********************************************************************
  2980. * DEFAULTSMAILRUN()
  2981. * Calls checkchanged(), configmrun()
  2982. * Called by:
  2983. *     MRUN210H:  parsemenu()
  2984. * Corresponds to the Configure.Defaults.MailRun menu selection.
  2985. *     
  2986. *********************************************************************
  2987. #endcomment
  2988.  
  2989. proc defaultsmailrun
  2990. #ifdef MRUN210B
  2991.     if FLAGS & DEFAULTS
  2992.         return
  2993.     endif
  2994. #endif
  2995.     if checkchanged()
  2996.         ;reset all flags but RUNNING and set the DEFAULTS flag
  2997.         FLAGS &= RUNNING
  2998.         FLAGS |= DEFAULTS
  2999.         configmrun()
  3000.     endif
  3001. endproc
  3002.  
  3003.  
  3004. #comment
  3005. *********************************************************************
  3006. * CONFIGMRUN()
  3007. * Calls MRUN210B\main(), makefullname(), callscript()
  3008. * Called by:
  3009. *     MRUN210H:  cfgmrun(), defaultsmailrun()
  3010. * Calls the changesettings script module.
  3011. *     
  3012. *********************************************************************
  3013. #endcomment
  3014.  
  3015. proc configmrun
  3016. #ifdef MRUN210B
  3017.         main()
  3018. #else
  3019. string changesettings
  3020.         changesettings = makefullname(MailRunDir, "MRUN210B")
  3021.         callscript(changesettings)
  3022. #endif
  3023. endproc
  3024.  
  3025.  
  3026. #comment
  3027. *********************************************************************
  3028. * CFGBBS()
  3029. * Calls checkchanged(), checknew(), configbbs()
  3030. * Called by:
  3031. *     MRUN210H:  parsemenu(), parseobject()
  3032. *     MRUN210C:  changeprompts(), changemaildoor()
  3033. * Corresponds to the Configure.BBS_Settings menu selection.
  3034. *********************************************************************
  3035. #endcomment
  3036.  
  3037. proc cfgbbs
  3038.     if checkchanged() && checknew()
  3039.         FLAGS &= RUNNING
  3040.         configbbs()
  3041.     endif
  3042. endproc
  3043.  
  3044.  
  3045. #comment
  3046. *********************************************************************
  3047. * DEFAULTSBBS()
  3048. * Calls checkchanged(), configbbs()
  3049. * Called by:
  3050. *     MRUN210H:  parsemenu()
  3051. *     MRUN210C:  changeprompts(), changemaildoor()
  3052. * Corresponds to the Configure.Defaults.BBS menu selection.
  3053. *********************************************************************
  3054. #endcomment
  3055.  
  3056. proc defaultsbbs
  3057.     if checkchanged()
  3058.         FLAGS &= RUNNING
  3059.         FLAGS |= DEFAULTS
  3060.         configbbs()
  3061.     endif
  3062. endproc
  3063.  
  3064.  
  3065. #comment
  3066. *********************************************************************
  3067. * CONFIGBBS()
  3068. * Calls makefullname(), callscript(), changeuserinfo()
  3069. * Called by:
  3070. *     MRUN210H:  cfgbbs(), defaultsbbs()
  3071. * Calls the changebbs script module for the changeuserinfo()
  3072. * procedure.
  3073. *********************************************************************
  3074. #endcomment
  3075.  
  3076. proc configbbs
  3077. #ifndef MRUN210C
  3078. string changebbs
  3079.         FLAGS = (FLAGS & CLEARCMD) | USR
  3080.         changebbs = makefullname(MailRunDir, "MRUN210C")
  3081.         callscript(changebbs)
  3082. #else
  3083.         changeuserinfo()
  3084. #endif
  3085. endproc
  3086.  
  3087.  
  3088. #comment
  3089. *********************************************************************
  3090. * CFGPROMPTS()
  3091. * Calls checkchanged(), checknew(), configprompts
  3092. * Called by:
  3093. *     MRUN210H:  parsemenu()
  3094. *     MRUN210C:  changeuserinfo(), changemaildoor()
  3095. * Corresponds to the Configure.BBS_Prompts menu settings.
  3096. *********************************************************************
  3097. #endcomment
  3098.  
  3099. proc cfgprompts
  3100.     if checkchanged() && checknew()
  3101.         FLAGS &= RUNNING
  3102.         configprompts()
  3103.     endif
  3104. endproc
  3105.  
  3106.  
  3107. #comment
  3108. *********************************************************************
  3109. * DEFAULTSPROMPTS()
  3110. * Calls checkchanged(), configprompts()
  3111. * Called by:
  3112. *     MRUN210H:  parsemenu()
  3113. *     MRUN210C:  changeuserinfo(), changemaildoor()
  3114. * Corresponds to the Configure.Defaults.Prompts menu selection.
  3115. *********************************************************************
  3116. #endcomment
  3117.  
  3118. proc defaultsprompts
  3119.     if checkchanged()
  3120.         FLAGS &= RUNNING
  3121.         FLAGS |= DEFAULTS
  3122.         configprompts()
  3123.     endif
  3124. endproc
  3125.  
  3126.  
  3127. #comment
  3128. *********************************************************************
  3129. * CONFIGPROMPTS()
  3130. * Calls makefullname(), callscript(), changeprompts()
  3131. * Called by:
  3132. *     MRUN210H:  cfgprompts(), defaultsprompts()
  3133. * Calls the changebbs script module for the changeprompts()
  3134. * procedure.
  3135. *********************************************************************
  3136. #endcomment
  3137.  
  3138. proc configprompts
  3139. #ifndef MRUN210C
  3140. string changebbs
  3141.     FLAGS = (FLAGS & CLEARCMD) | PRMPT
  3142.     changebbs = makefullname(MailRunDir, "MRUN210C")
  3143.     callscript(changebbs)
  3144. #else
  3145.     changeprompts()
  3146. #endif
  3147. endproc
  3148.  
  3149.  
  3150. #comment
  3151. *********************************************************************
  3152. * CFGMAILDOOR()
  3153. * Calls checkchanged(), checknew(), configmaildoor()
  3154. * Called by:
  3155. *     MRUN210H:  parsemenu()
  3156. *     MRUN210C:  changeuserinfo(), changeprompts()
  3157. * Corresponds to the Configure.BBS_Mail_Door menu selection.
  3158. *********************************************************************
  3159. #endcomment
  3160.  
  3161. proc cfgmaildoor
  3162.     if checkchanged() && checknew()
  3163.         FLAGS &= RUNNING
  3164.         configmaildoor()
  3165.     endif
  3166. endproc
  3167.  
  3168.  
  3169. #comment
  3170. *********************************************************************
  3171. * DEFAULTSDOOR()
  3172. * Calls checkchanged(), configmaildoor()
  3173. * Called by:
  3174. *     MRUN210H:  parsemenu()
  3175. *     MRUN210C:  changeuserinfo(), changeprompts()
  3176. * Corresponds to the Configure.Defaults.Mail_Door menu selection.
  3177. *********************************************************************
  3178. #endcomment
  3179.  
  3180. proc defaultsdoor
  3181.     if checkchanged()
  3182.         FLAGS &= RUNNING
  3183.         FLAGS |= DEFAULTS
  3184.         configmaildoor()
  3185.     endif
  3186. endproc
  3187.  
  3188.  
  3189. #comment
  3190. *********************************************************************
  3191. * CONFIGMAILDOOR()
  3192. * Calls makefullname(), callscript(), changemaildoor()
  3193. * Called by:
  3194. *     MRUN210H:  cfgmaildoor(), defaultsmaildoor()
  3195. * Calls the changebbs script module for the changemaildoor()
  3196. * procedure.
  3197. *********************************************************************
  3198. #endcomment
  3199.  
  3200. proc configmaildoor
  3201. #ifndef MRUN210C
  3202. string changebbs
  3203.     FLAGS = (FLAGS & CLEARCMD) | QMD
  3204.     changebbs = makefullname(MailRunDir, "MRUN210C")
  3205.     callscript(changebbs)
  3206. #else
  3207.     changemaildoor()
  3208. #endif
  3209. endproc
  3210.  
  3211.  
  3212. #comment
  3213. *********************************************************************
  3214. * ADDNEWBBS()
  3215. * Calls checkchanged(), makefullname(), callscript()
  3216. * MRUN210C\changeuserinfo()
  3217. * Called by:
  3218. *     MRUN210H:  parsemenu(), parseobject()
  3219. * Corresponds to the Add.New_BBS menu selection.  Calls the
  3220. * changebbs module for the changeuserinfo() procedure with 
  3221. * the NEW flag set.
  3222. *********************************************************************
  3223. #endcomment
  3224.  
  3225. proc addnewbbs
  3226. #ifndef MRUN210C
  3227. string changebbs
  3228. #endif
  3229.     if checkchanged()
  3230.         FLAGS &= RUNNING
  3231.         FLAGS |= NEW
  3232. #ifndef MRUN210C
  3233.         FLAGS = (FLAGS & CLEARCMD) | USR
  3234.         changebbs = makefullname(MailRunDir, "MRUN210C")
  3235.         callscript(changebbs)
  3236. #else
  3237.         changeuserinfo()
  3238. #endif
  3239.     endif
  3240. endproc
  3241.  
  3242.  
  3243. #comment
  3244. *********************************************************************
  3245. * ADDGETSEND()
  3246. * Calls checkchanged(), checknew(), makefullname(), callscript()
  3247. * MRUN210F\addgetmail()
  3248. * Called by:
  3249. *     MRUN210H:  parsemenu(), parseobject()
  3250. * Corresponds to the Add.Get/Send_Mail menu selection.  Calls
  3251. * the othercmds script module for the addgetmail() procedure.
  3252. *********************************************************************
  3253. #endcomment
  3254.  
  3255. proc addgetsend
  3256. #ifndef MRUN210F
  3257. string othercmds
  3258. #endif
  3259.     if checkchanged() && checknew()
  3260.         FLAGS &= RUNNING
  3261. #ifndef MRUN210F
  3262.         FLAGS = (FLAGS & CLEARCMD) | AGM
  3263.         othercmds = makefullname(MailRunDir, "MRUN210F")
  3264.         callscript(othercmds)
  3265. #else
  3266.         addgetmail()
  3267. #endif
  3268.     endif
  3269. endproc
  3270.  
  3271.  
  3272. #comment
  3273. *********************************************************************
  3274. * ADDDOWNLOAD()
  3275. * Calls checkchanged(), checknew(), makefullname(), callscript()
  3276. * Called by:
  3277. *     MRUN210H:  parsemenu(), parseobject()
  3278. * Corresponds to the Add.Download_File menu selection.  Calls
  3279. * the adddlfile script module.
  3280. *********************************************************************
  3281. #endcomment
  3282.  
  3283. proc adddownload
  3284. #ifndef MRUN210D
  3285. string adddlfile
  3286.     if checkchanged() && checknew()
  3287.         FLAGS &= RUNNING
  3288.         adddlfile = makefullname(MailRunDir, "MRUN210D")
  3289.         callscript(adddlfile)
  3290.     endif
  3291. #endif
  3292. endproc
  3293.  
  3294.  
  3295. #comment
  3296. *********************************************************************
  3297. * ADDUPLOAD()
  3298. * Calls checkchanged(), checknew(), makefullname(), callscript()
  3299. * Called by:
  3300. *     MRUN210H:  parsemenu(), parseobject()
  3301. *     
  3302. * Corresponds to the Add.Upload_File menu selection.  Calls
  3303. * the addulfile script module.
  3304. *********************************************************************
  3305. #endcomment
  3306.  
  3307. proc addupload
  3308. #ifndef MRUN210E
  3309. string addulfile
  3310.     if checkchanged() && checknew()
  3311.         FLAGS &= RUNNING
  3312.         addulfile = makefullname(MailRunDir, "MRUN210E")
  3313.         callscript(addulfile)
  3314.     endif
  3315. #endif
  3316. endproc
  3317.  
  3318.  
  3319. #comment
  3320. *********************************************************************
  3321. * ADDSENDCMD()
  3322. * Calls checkchanged(), checknew(), makefullname(), callscript(),
  3323. * MRUN210F\addsendcommand()
  3324. * Called by:
  3325. *     MRUN210H:  parsemenu(), parseobject()
  3326. *     
  3327. * Corresponds to the Add.Send_Command menu selection.  Calls
  3328. * the othercmds script module for the addsendcommand() procedure.
  3329. *********************************************************************
  3330. #endcomment
  3331.  
  3332. proc addsendcmd
  3333. #ifndef MRUN210F
  3334. string othercmds
  3335. #endif
  3336.     if checkchanged() && checknew()
  3337.         FLAGS &= RUNNING
  3338. #ifndef MRUN210F
  3339.         FLAGS = (FLAGS & CLEARCMD) | CMD
  3340.         othercmds = makefullname(MailRunDir, "MRUN210F")
  3341.         callscript(othercmds)
  3342. #else
  3343.         addsendcommand()
  3344. #endif
  3345.     endif
  3346. endproc
  3347.  
  3348.  
  3349. #comment
  3350. *********************************************************************
  3351. * ADDSCRIPT()
  3352. * Calls checkchanged(), checknew(), makefullname(), callscript(),
  3353. * MRUN210F\adddoscript()
  3354. * Called by:
  3355. *     MRUN210H:  parsemenu(), parseobject()
  3356. *     
  3357. * Corresponds to the Add.Execute_Script menu selection.  Calls
  3358. * the othercmds script module for the adddoscript() procedure.
  3359. *********************************************************************
  3360. #endcomment
  3361.  
  3362. proc addscript
  3363. #ifndef MRUN210F
  3364. string othercmds
  3365. #endif
  3366.     if checkchanged() && checknew()
  3367.         FLAGS &= RUNNING
  3368. #ifndef MRUN210F
  3369.         FLAGS = (FLAGS & CLEARCMD) | SCR
  3370.         othercmds = makefullname(MailRunDir, "MRUN210F")
  3371.         callscript(othercmds)
  3372. #else
  3373.         adddoscript()
  3374. #endif
  3375.     endif
  3376. endproc
  3377.  
  3378.  
  3379. #comment
  3380. *********************************************************************
  3381. * EXECUTEMAILRUN()
  3382. * Called by:
  3383. *     MRUN210H:  parsemenu(), parseobject()
  3384. *     
  3385. * Corresponds to the Execute.Execute/Terminate_MailRun menu
  3386. * selection.
  3387. *********************************************************************
  3388. #endcomment
  3389.  
  3390. proc executemailrun
  3391. #ifdef MRUN210G
  3392.     hangup
  3393.     FLAGS &= IDLE
  3394.     capture OFF
  3395.     exit
  3396. #else
  3397.     if FLAGS & RUNNING
  3398.         FLAGS &= IDLE
  3399.     else
  3400.         FLAGS |= RUNNING
  3401.     endif
  3402. #endif
  3403. endproc
  3404.  
  3405.  
  3406. #comment
  3407. *********************************************************************
  3408. * EXECUTEARCHIVER()
  3409. * Calls checktask()
  3410. * Called by:
  3411. *     MRUN210H:  parsemenu(), parseobject()
  3412. * Corresponds to the Execute.Archiver menu selection.  Calls
  3413. * the archive utility specified in the MailRun Settings
  3414. * dialog.
  3415. *********************************************************************
  3416. #endcomment
  3417.  
  3418. proc executearchiver
  3419. integer i
  3420. #ifndef MRUN210AB
  3421. string Archiver
  3422. #endif
  3423.     profilerd MailRun "MailRun" "Archiver" Archiver
  3424.     if not NULLSTR Archiver
  3425.         i = checktask(Archiver)
  3426.         if i
  3427.             activatetask i
  3428.         else
  3429.             run Archiver
  3430.         endif
  3431.         if FAILURE
  3432.             usermsg "Unable to run Archive Utility %s .`r`n\
  3433. The file does not exist or is not in your DOS path." Archiver
  3434.         endif
  3435.     else
  3436.         usermsg "You must specify an Archive Utility in`r`n\
  3437. the MailRun Settings dialog box."
  3438.     endif
  3439. endproc
  3440.  
  3441.  
  3442. #comment
  3443. *********************************************************************
  3444. * EXECUTEQWKREADER()
  3445. * Calls checktask()
  3446. * Called by:
  3447. *     MRUN210H:  parsemenu(), parseobject()
  3448. * Corresponds to the Execute.QWK_Reader menu selection.  Calls
  3449. * the QWK mail reader specified in the MailRun Settings
  3450. * dialog.
  3451. *********************************************************************
  3452. #endcomment
  3453.  
  3454. proc executeqwkreader
  3455. integer i
  3456. #ifndef MRUN210AB
  3457. string QWKReader
  3458. #endif
  3459.     profilerd MailRun "MailRun" "QWKReader" QWKReader
  3460.     if not NULLSTR QWKReader
  3461.         i = checktask(QWKReader)
  3462.         if i
  3463.             activatetask i
  3464.         else
  3465.             run QWKReader
  3466.         endif
  3467.         if FAILURE
  3468.             usermsg "Unable to run QWK Mail Reader %s.`r`n\
  3469. The file does not exist or is not in your DOS path." QWKReader
  3470.         endif
  3471.     else
  3472.         usermsg "You must specify a QWK Mail Reader in`r`n\
  3473. the MailRun Settings dialog box."
  3474.     endif
  3475. endproc
  3476.  
  3477.  
  3478. #comment
  3479. *********************************************************************
  3480. * EXECUTELOGVIEWER()
  3481. * Calls checktask(), makefullname()
  3482. * Called by:
  3483. *     MRUN210H:  parsemenu(), parseobject()
  3484. *     
  3485. * Corresponds to the Execute.View_Log_File menu selection.  
  3486. * Calls the file viewer specified in the MailRun Settings
  3487. * dialog and loads the log file for the current mailrun.
  3488. *********************************************************************
  3489. #endcomment
  3490.  
  3491. proc executelogviewer
  3492. string CapFile, RunLine, WinTitle
  3493. integer i, j
  3494. #ifndef MRUN210AB
  3495. string LogViewer
  3496. #endif
  3497.     profilerd MailRun "MailRun" "LogViewer" LogViewer
  3498.     if not NULLSTR LogViewer
  3499.         if not NULLSTR MailRunTrunc
  3500.             CapFile = makefullname(MailRunDir, MailRunTrunc)
  3501.             strlwr CapFile
  3502.             strreplace CapFile ".mrn" ".cap"
  3503.         else
  3504.             CapFile = ""
  3505.         endif
  3506.         i = checktask(LogViewer)
  3507.         if i
  3508.             taskwin i j
  3509.             getwintext j WinTitle
  3510.             if strfind WinTitle CapFile
  3511.                 activatetask i
  3512.                 return
  3513.             endif
  3514.         endif
  3515.         strfmt RunLine "%s %s" LogViewer CapFile
  3516.         run RunLine
  3517.         if FAILURE
  3518.             usermsg "Unable to run Log File Viewer %s.`r`n\
  3519. The file does not exist or is not in your DOS path." LogViewer
  3520.         endif
  3521.     else
  3522.         usermsg "You must specify a Log File Viewer in`r`n\
  3523. the MailRun Settings dialog box."
  3524.     endif
  3525. endproc
  3526.  
  3527.  
  3528. #comment
  3529. *********************************************************************
  3530. * HELPCONTENTS()
  3531. * Called by:
  3532. *     MRUN210H:  parsemenu()
  3533. * Corresponds to the Help.Contents menu selection.  Calls 
  3534. * the help file and displays the contents page.
  3535. *********************************************************************
  3536. #endcomment
  3537.  
  3538. proc helpcontents
  3539.     help 1
  3540. endproc
  3541.  
  3542.  
  3543. #comment
  3544. *********************************************************************
  3545. * HELPCONTEXT()
  3546. * Called by:
  3547. *     MRUN210H:  parsemenu(), parseobject()
  3548. * Corresponds to the Help.On_current_window menu selection.
  3549. * Calls the help file and displays the page appropriate for
  3550. * the current dialog box.  HelpPage is a global variable set
  3551. * in each procedure that calls a dialog box.
  3552. *********************************************************************
  3553. #endcomment
  3554.  
  3555. proc helpcontext
  3556.     help HelpPage
  3557. endproc
  3558.  
  3559.  
  3560. #comment
  3561. *********************************************************************
  3562. * HELPABOUT()
  3563. * Calls checkchanged(), makefullname(), callscript(),
  3564. * MRUN210F\showabout()
  3565. * Called by:
  3566. *     MRUN210H:  parsemenu()
  3567. *     MRUN210A:  main()
  3568. * Corresponds to the Help.About_MailRun menu selection.  Calls
  3569. * the othercmds script module for the showabout() procedure.
  3570. *********************************************************************
  3571. #endcomment
  3572.  
  3573. proc helpabout
  3574. #ifndef MRUN210F
  3575. string othercmds
  3576. #endif
  3577.     if checkchanged()
  3578.         FLAGS &= RUNNING
  3579. #ifndef MRUN210F
  3580.         FLAGS = (FLAGS & CLEARCMD) | ABT
  3581.         othercmds = makefullname(MailRunDir, "MRUN210F")
  3582.         callscript(othercmds)
  3583. #else
  3584.         showabout()
  3585. #endif
  3586.     endif
  3587. endproc
  3588.  
  3589.  
  3590. #comment
  3591. *********************************************************************
  3592. * CALLSCRIPT()
  3593. * Calls menudim(), makemailrunlist(), makebbslist(),
  3594. * maketasklist(), getfirstitem(), MRUN210AG\mailrunbox()
  3595. * Called by:
  3596. *     MRUN210H:  filenewmrun(), configmrun(), configbbs(),
  3597. *                   configprompts(), configmaildoor(), addnewbbs(),
  3598. *                   addgetsend(), adddownload(), addupload(),
  3599. *                   addsendcmd(), addscript(), helpabout()
  3600. * Executes the specified MailRun script module.
  3601. *********************************************************************
  3602. #endcomment
  3603.  
  3604. proc callscript
  3605. strparm ScriptTitle
  3606. #ifndef MRUN210AG
  3607.     chain ScriptTitle
  3608. #else
  3609. string LastMRun
  3610.     LastMRun = MailRun
  3611.     execute ScriptTitle
  3612.     menudim()
  3613.     FLAGS &= RUNNING
  3614. #ifdef MRUN210G
  3615.     if !(FLAGS & RUNNING)
  3616.         ;if the mailrun has been terminated from another script module...
  3617.         executemailrun()
  3618.     endif
  3619.     profilerd MailRun "MailRun" "LogRun" LogRun
  3620.     if LogRun
  3621.         profilerd MailRun "MailRun" "AnsiInLog" AnsiInLog
  3622.         if AnsiInLog
  3623.             set capture mode append RAW
  3624.         else
  3625.             set capture mode append VISUAL
  3626.         endif
  3627.         capture ON
  3628.     else
  3629.         capture OFF
  3630.     endif
  3631. #else
  3632.     findfirst MailRun
  3633.     MailRunTrunc = $FILENAME
  3634.     makemailrunlist()
  3635.     makebbslist()
  3636. #endif
  3637.     maketasklist()
  3638.     if not strcmpi LastMRun MailRun
  3639.         getfirstitem()
  3640.     endif
  3641.     mailrunbox()
  3642.     statmsg ""
  3643. #endif
  3644. endproc
  3645.  
  3646.  
  3647.  
  3648.